antvis / X6

🚀 JavaScript diagramming library that uses SVG and HTML for rendering.
https://x6.antv.antgroup.com
MIT License
5.72k stars 1.7k forks source link

x6-plugin-history 插件设置{ ignoreChange: true } 以后, 还原连线删除操作时,连线找不到target #4487

Open htp411 opened 2 hours ago

htp411 commented 2 hours ago

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

  1. x6-plugin-history 插件设置{ ignoreChange: true }
  2. 增加连线
  3. control + z 撤销
  4. control + shift + z 还原
  5. 连线找不到target节点

Expected behavior

x6-plugin-history 插件设置{ ignoreChange: true } 以后, 还原连线删除操作时,连线能正常找到target节点

Screenshots or Videos

No response

Platform

Additional context

No response

x6-bot[bot] commented 2 hours ago

👋 @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.