x6-plugin-history 插件设置{ ignoreChange: true } 以后, 还原连线删除操作时,连线找不到target
Describe the bug
配置项
// 忽略添加和删除之外的所有操作
graph.use(new History({
ignoreChange: true,
}))
graph.on('history:undo', ({ cmds }) => {
console.log(cmds);
// 删除时其实是有两条记录:删除和改变target,由于改变target这个记录会被忽略,导致还原删除的时候,连线找不到终点
/*
*{batch: true, data: {…}, event: 'cell:added', options: {…}}
*{batch: true, data: {…}, event: 'cell:change:target', options: {…}}
*/
})
Your Example Website or App
https://stackblitz.com/edit/vitejs-vite-1dbuk4?file=src%2Fstyle.css
Steps to Reproduce the Bug or Issue
- x6-plugin-history 插件设置{ ignoreChange: true }
- 增加连线
- control + z 撤销
- control + shift + z 还原
- 连线找不到target节点
Expected behavior
x6-plugin-history 插件设置{ ignoreChange: true } 以后, 还原连线删除操作时,连线能正常找到target节点
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version:
- "@antv/x6": "^2.18.1",
- "@antv/x6-plugin-history": "^2.2.4",
Additional context
No response
👋 @htp411
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.
确实https://x6.antv.antgroup.com/examples/showcase/practices/#flowchart 官方示例中,90行增加配置 new History({ ignoreChange: true }), 点击ctrl + z后再点击ctrl + shift + z, 连接线无法还原。
ignoreChange 为 true 时,元素熟悉的变化不会被记录,不配置或者设置为 false 即可。