-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
使用DagreLayout布局时,nodes数组中节点的顺序会导致连线交叉 #2816
Comments
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
layout 是不支持带连接桩的布局的 只支持节点和连线。 如果带上连接桩的话,处理方式我们思考一下。 |
@NewByVector 好的吧,那我只能先手动处理下nodes数组里的节点顺序了 |
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. |
问题描述
使用DagreLayout布局,nodes数组中节点的顺序,会影响绘制出的连线(edge)交叉
重现链接
https://codesandbox.io/s/x6-demo-m47ti6?file=/src/FlowGraph.vue
重现步骤
点击重现链接打开demo
点击mock2按钮显示的是交叉的连线,点击mock3按钮显示的是正确的连线
mock2.json和mock3.json的数据差别:nodes数组中,id为2的节点和id为11的节点顺序有区别
mock2.json中nodes数组的id顺序为:1,2,8,11,17
mock3.json中nodes数组的id顺序为:1,8,11,2,17
在控制台输入
graph.getNodes().map(item => item.id)
,打印出的节点id顺序均为["1", "2", "8", "11", "17"]
在控制台输入
graph.getEdges().map(item => `${item.source.cell} -> ${item.target.cell}`)
,打印出的edge均为['1 -> 8', '8 -> 11', '8 -> 2', '2 -> 17']
预期行为
使用布局的情况下,节点数组中节点的顺序不应该影响到最终绘制出的图,不然使用布局的意义在哪?
平台
屏幕截图或视频(可选)
补充说明(可选)
业务场景使用中保存数据,通过graph.getNodes()获取节点数组,但是使用这个节点数组去布局却会导致连线交叉
The text was updated successfully, but these errors were encountered: