-
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
同一节点现存的两个链接桩如何互相交换位置? #3846
Comments
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. |
可以先删除再添加: const ports = source.getPorts()
source.removePorts(ports)
source.addPorts(ports.reverse()) |
先删除的话,链接桩上的连线会断掉,还需要重新连线,数据量大的情况,不太友好。有没有更好的办法? |
可以这样操作: const ports = [
{
id: '1',
attrs: {
text: {
text: '1'
},
}
},
{
id: '2',
attrs: {
text: {
text: '2'
},
}
}
]
const source = graph.addNode({
shape: 'rect',
x: 80,
y: 80,
width: 160,
height: 60,
label: 'source',
ports,
})
const target = graph.addNode({
shape: 'rect',
x: 320,
y: 320,
width: 160,
height: 60,
label: 'target',
})
graph.addEdge({
source,
target,
})
source.prop('ports/items', ports.reverse()) |
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. |
功能描述
现在有一个节点有一个链接桩组,组中分别由A,B两个连接桩,现在要求这两个连接桩可以互相交换位置
期望解决方案
node.port.ports.reverse() 后,有没有更新节点视图的方法?或者别的可以修改位置方法?
The text was updated successfully, but these errors were encountered: