Skip to content
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

移动连线无效还原后,历史队列不知为何被清空,导致无法redo #3707

Open
linkun-wang opened this issue Jun 25, 2023 · 2 comments
Labels
type: bug 缺陷 Defects and unexpected behaviors

Comments

@linkun-wang
Copy link
Contributor

linkun-wang commented Jun 25, 2023

Describe the bug

移动连线到空白处,松开鼠标,该连线还原后无法重做了(连线被还原后,感觉整个历史队列被清空了,而且history.on('change')没有监听到这一变化)
无法redo

Your Example Website or App

https://codesandbox.io/s/lian-xian-yi-dong-hou-wu-fa-chong-zuo-wen-ti-wq8vj4?file=/src/app.tsx

Steps to Reproduce the Bug or Issue

  1. 随便移动一个节点(使某个操作记录到历史队列中)
  2. 点击【撤销】按钮
  3. 移动连线起点或终点到空白处,松开鼠标,使连线还原
  4. 点击【重做】按钮,会发现无法重做了

Expected behavior

连线移动无效被还原后,不要影响之前的历史队列

Screenshots or Videos

No response

Platform

  • OS: [Windows]
  • Browser: [Chrome 114]
  • X6版本: [1.32.8]

Additional context

No response

@NewByVector
Copy link
Contributor

NewByVector commented Jun 28, 2023

其实所有会导致元素属性变更的操作都会导致 redo 队列被清空,只不过连线校验失败重新还原到原来的连接桩,在在用户看来是一个无效的操作,不应该记录到历史记录中,同时不应该导致 redo 队列清空。这个问题暂时还没有好的方案来解决。

@NewByVector NewByVector added type: discussion 讨论 Usage questions, guidance, and other discussions type: bug 缺陷 Defects and unexpected behaviors and removed type: discussion 讨论 Usage questions, guidance, and other discussions labels Jun 28, 2023
@NewByVector
Copy link
Contributor

这个场景还是推荐再监听一下 batch 时间,以获取最新的 undoredo 状态。

graph.history.on("batch", (args) => {
  this.setState({
    canUndo: this.graph.history.canUndo(),
    canRedo: this.graph.history.canRedo()
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 缺陷 Defects and unexpected behaviors
Projects
None yet
Development

No branches or pull requests

2 participants