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

节点更新数据逻辑 #19

Open
lloydzhou opened this issue Feb 15, 2023 · 2 comments
Open

节点更新数据逻辑 #19

lloydzhou opened this issue Feb 15, 2023 · 2 comments

Comments

@lloydzhou
Copy link
Owner

当前仓库中通过watch指定的字段,然后调用x6的api更新节点。
image

这种模式代码写得很复杂,而且可能出现有一些属性没有提前监听到的情况。
参考最近新写的这个react hooks的逻辑,更新的时候,尝试使用createNode创建一个新的临时节点,然后通过getProp拿到两个store的数据进行对比再重新更新到画布。

antvis/X6#2834
https://github.com/lloydzhou/antv-x6-react-practice/blob/master/src/lib/hooks.js#L15
image

@lloydzhou lloydzhou changed the title 更新节点 更新节点逻辑 Feb 15, 2023
@lloydzhou lloydzhou changed the title 更新节点逻辑 节点更新数据逻辑 Feb 15, 2023
@lloydzhou
Copy link
Owner Author

调用setProp的时候,setProp(prop)Object.keys(prop).forEach(key => cell.setProp(key, prop[key])) 效果不一致
image

@lloydzhou lloydzhou mentioned this issue May 25, 2023
3 tasks
@ZWkang
Copy link

ZWkang commented Jun 23, 2024

感觉这一步放在数据最开始update的时候patch也可以 @lloydzhou

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

No branches or pull requests

2 participants