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

节点和线在拖拽过程中,不实时更改画布数据,只渲染一个中间过程虚拟节点 #3733

Open
MrMengJ opened this issue Jul 5, 2023 · 3 comments
Labels
type: feature 新功能 Feature/enhancement requests

Comments

@MrMengJ
Copy link
Contributor

MrMengJ commented Jul 5, 2023

功能描述

如下图所示,节点和线在拖拽过程中,不实时更改画布数据,只渲染一个中间过程虚拟节点,减少中间状态对数据的持续影响,也能提升性能

图形拖拽虚拟图形

期望解决方案

有没有好的解决思路

@lloydzhou
Copy link
Contributor

https://github.com/lloydzhou/x6-hooks

可以参考我这个地方的使用方法:

  1. 将x6的graph当作一个“受控”的组件
  2. 实际数组总是维护在自己外层组件的state里面。
  3. 在x6内部做交互的时候,总是放弃直接更改x6画布内的元素,而是通过回调去更新外层组件的state数据。
  4. state数据更新后,会自动将元素更改体现到画布上面

例如:

  1. 生成边的时候,通常validateEdge会返回true,确保交互式连接的边添加到画布。
  2. 现在只要重写validateEdge,需要添加边的时候,触发外层组件的callback更新state数据,往state内部添加一条边,当前的validateEdge永远返回false即可。

@NewByVector
Copy link
Contributor

这个功能我们后续会加上,主要是因为如果节点所连的边比较多的场景下,会出现移动卡顿现象。之前做过一些尝试

@NewByVector NewByVector added the type: feature 新功能 Feature/enhancement requests label Jul 10, 2023
@America-first-melon
Copy link

这个功能我们后续会加上,主要是因为如果节点所连的边比较多的场景下,会出现移动卡顿现象。之前做过一些尝试

请问一下有排版计划了吗? 如果最近没有更新计划,这个想法测试场景覆盖怎么样,可以直接按这个思路开发不

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