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

graph.getNodes() 返回的nodes数组的顺序不准确,没有按照实际数组顺序返回。 #2788

Closed
jiankafei opened this issue Oct 19, 2022 · 4 comments
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems

Comments

@jiankafei
Copy link

问题描述

graph.getNodes() 返回的nodes数组的顺序不准确,没有按照实际数组顺序返回。

重现链接

项目使用中的实际问题,无法提供复现链接

重现步骤

预期行为

返回的节点顺序和实际数据顺序一致。

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@NewByVector
Copy link
Contributor

没有按照实际数组返回是指什么?有具体的 demo 吗?

@NewByVector NewByVector added the resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems label Oct 25, 2022
@jiankafei
Copy link
Author

jiankafei commented Oct 25, 2022

没有按照实际数组返回是指什么?有具体的 demo 吗?

这个问题我这边已经查清楚了,x6 现在的逻辑是按照 zIndex来排序cells,我这边的需求是递归树渲染,因为没有相应的layout,只能自己编写整个布局逻辑,同时有对layout进行编辑的操作,需要每次编辑(比如添加,删除)后对原有树的数据进行获取并重新渲染,所以需要使用 graph.getNodes() 获取上一帧的数据结构,而数据的顺序就至关重要了,最后我通过删除 zIndex,使用默认排序获取的 nodes 完成了重渲染。所以如果有必要的话,可以考虑加个 sort 属性进行cells的排序,当然这需要你们的论证。

@NewByVector
Copy link
Contributor

@jiankafei 节点的 data 里面可以自定义数据,可以将 sort 属性放在你的 data 中。

@x6-bot
Copy link
Contributor

x6-bot bot commented Oct 27, 2023

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems
Projects
None yet
Development

No branches or pull requests

2 participants