Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 兼容不设置高度时,窗口变化后更新画布尺寸 #1900

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

menghany
Copy link

解决resize传递宽高后渲染无效,并兼容窗口变化事件。

Copy link

changeset-bot bot commented Oct 10, 2024

⚠️ No Changeset found

Latest commit: 87ec4a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@menghany
Copy link
Author

menghany commented Oct 10, 2024

#1889

@boyongjiong
Copy link
Collaborator

你好,这个功能都做了什么测试呢?是怎么测试的

@boyongjiong
Copy link
Collaborator

  1. 这个的实现是否有必要引入该额外的变量记录状态(isContainerWidth/isContainerHeight)。

  2. graphModel 传入 Graph 组件,组件会根据 props 变化自动更新,下面 needUpdate 的状态值我也没看到使用的地方。

  3. 只看代码 diff,style 是在哪儿定义的变量,没看到定义怎么就直接使用了呢

那个 issue 的 codesandbox 我没打开。我现在的理解,如果 resize 未生效,先确认 resize 后,graphModel 中的 width/height 是否变成了预期的值。1. 如果值变了,容器样式没有变,那根据 width、height 值更新容器样式即可;2. 如果值没有变,先定位问题(为什么没变),再按 1 的逻辑处理。

@menghany
Copy link
Author

menghany commented Oct 12, 2024

@boyongjiong
我观察git提交记录,resize没有变化是因为此次提交 d3d1cbb,增加了自适应的同时删除了style属性引用
image
实际上当前代码存在style声明,只是去掉了属性的使用。

我目前想到的能够兼容不配置宽或者高度时重新resize及配置时不清空resize,加入了两个属性记录。

@menghany
Copy link
Author

你好,这个功能都做了什么测试呢?是怎么测试的

image
我使用此测试demo,增加了变更尺寸的方法。但是此提交我没有增加。如果这种测试方式正确,我可以补充commit

@boyongjiong
Copy link
Collaborator

你好,这个功能都做了什么测试呢?是怎么测试的

image 我使用此测试demo,增加了变更尺寸的方法。但是此提交我没有增加。如果这种测试方式正确,我可以补充commit

是这样的,提交一下吧,我看一下。建议后续 PR 也是提供测试的代码,就跟你现在做的这个一样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants