X6
X6 copied to clipboard
parent变化的撤回有问题
Describe the bug
https://codesandbox.io/s/ecstatic-leaf-hvb24e 问题1: 把 innerBox 拖拽进 outterBox,点击撤回。然后移动innerBox到outterBox中,拖拽outterBox,innerBox不动。
问题2: 把 innerBox 拖拽进 outterBox,然后拖出来,点击撤回。拖拽outterBox,innerBox会跟着动。
问题3: 把 innerBox 拖拽进 outterBox,然后拖出来。点击撤回,然后移动innerBox到outterBox中,拖拽outterBox,innerBox移动两倍的距离。
这个操作还有很多类似问题,大概应该是同一个问题导致的吧
Your Example Website or App
https://codesandbox.io/s/ecstatic-leaf-hvb24e
Steps to Reproduce the Bug or Issue
同上
Expected behavior
表现正常即可
Screenshots or Videos
No response
Platform
- OS: [macOS]
- Browser: [Chrome]
- Version: [1.32.9]
Additional context
No response
原因好像是因为 change 了 父元素的 children 和 子元素 parent 需要 两次撤回才能成功。
目前观察到的情况是,在「把 innerBox 拖拽进 outterBox」这一过程结束后的瞬间 (immediately after),即鼠标松开时,在 history 中推入了三组操作,每组中都仅有一个操作,它们分别是位移、更新 innerBox parent、更新 outerBox children
["cell:change:position"]
["cell:change:parent"]
["cell:change:children"]
这里认为,在理想的情况下,这里应当推入一组操作,在这组操作中包含所有发生的事件
["cell:change:position", "cell:change:parent", "cell:change:children"]
这时 undo() 一次(点击一次撤销)即可将画布还原为「节点位移」前的状态
Edit: typos
This thread has been automatically locked because it has not had recent activity.
Please open a new issue for related bugs and link to relevant comments in this thread.