X6 icon indicating copy to clipboard operation
X6 copied to clipboard

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

Open htp411 opened this issue 1 year ago • 2 comments

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

  • OS: macOS
  • Browser: Chrome
  • Version:
    • "@antv/x6": "^2.18.1",
    • "@antv/x6-plugin-history": "^2.2.4",

Additional context

No response

htp411 avatar Oct 31 '24 06:10 htp411

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

x6-bot[bot] avatar Oct 31 '24 06:10 x6-bot[bot]

确实https://x6.antv.antgroup.com/examples/showcase/practices/#flowchart 官方示例中,90行增加配置 new History({ ignoreChange: true }), 点击ctrl + z后再点击ctrl + shift + z, 连接线无法还原。

Image

SecretCastle avatar Mar 24 '25 11:03 SecretCastle

ignoreChange 为 true 时,元素熟悉的变化不会被记录,不配置或者设置为 false 即可。

lxfu1 avatar Sep 08 '25 02:09 lxfu1