antvis/G6
The issue has been closed
When updating the order of child nodes, I need to call updateChildren and update edge separately, is there a better way to handle it? #6317
cicada-ah posted onGitHub
Describe the bug / 问题描述
当更新子节点顺序时,我需要分别调用updateChildren和更新edge的处理,如下
const item = graph.findById(nodeId)
graph.updateChildren(newChildren, item.getID())
if ('getEdges' in item) {
const outPutEdges = item.getOutEdges()
outPutEdges.forEach((edge, i) => {
edge.setTarget(graph.findById(newChildren[i].id))
edge.refresh()
})
}
Reproduction link / 重现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
No response
G6 Version / G6 版本
🆕 5.x
Operating System / 操作系统
macOS
Browser / 浏览器
Chrome
Additional context / 补充说明
No response