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

思维导图在新增节点时,闪烁 #3861

Open
wu0211 opened this issue Aug 17, 2023 · 3 comments
Open

思维导图在新增节点时,闪烁 #3861

wu0211 opened this issue Aug 17, 2023 · 3 comments
Labels
type: feature 新功能 Feature/enhancement requests

Comments

@wu0211
Copy link

wu0211 commented Aug 17, 2023

问题描述

在其中新增这段代码,新加200个节点后,再按tab新增节点就会闪缩

function test(){ for(var i=0;i<=200;i++){ data.children.push({ id: '1-1'+i, type: 'topic-branch', label: '分支主题1'+i, width: 100, height: 40, }) } } test()

image

重现链接

https://x6.antv.antgroup.com/zh/examples/showcase/practices#mindmap

重现步骤

https://x6.antv.antgroup.com/zh/examples/showcase/practices#mindmap

预期行为

如何能做到新增节点不闪,只新增节点布局刷新,或者刷新丝滑一些

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [2.11.1 ...]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@wu0211
Copy link
Author

wu0211 commented Aug 18, 2023

@NewByVector 这个有什么解决方案吗

@qiufeihong2018
Copy link
Contributor

官网例子不太好,用的是全量刷新,复杂度是是O(n)的。其中更新图都是graph.resetCells(cells)来弄的。
建议增删改节点,用局部刷新,复杂度是O(1)。可以使用removeCell、addNode、addEdge等来删除单元、添加节点和边。
具体看例子:examples/x6-example-features/src/pages/case/mind.tsx

@NewByVector NewByVector added the type: feature 新功能 Feature/enhancement requests label Oct 12, 2023
@cjmafei
Copy link

cjmafei commented Dec 10, 2024

@qiufeihong2018 而你,才是真正的英雄!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature 新功能 Feature/enhancement requests
Projects
None yet
Development

No branches or pull requests

4 participants