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

parent变化的撤回有问题 #2421

Closed
fanmingfei opened this issue Jul 25, 2022 · 3 comments · Fixed by #2492
Closed

parent变化的撤回有问题 #2421

fanmingfei opened this issue Jul 25, 2022 · 3 comments · Fixed by #2492
Assignees
Labels
type: bug 缺陷 Defects and unexpected behaviors

Comments

@fanmingfei
Copy link

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

@fanmingfei
Copy link
Author

原因好像是因为 change 了 父元素的 children 和 子元素 parent 需要 两次撤回才能成功。

@tonywu6 tonywu6 added the type: bug 缺陷 Defects and unexpected behaviors label Jul 27, 2022
@tonywu6
Copy link
Contributor

tonywu6 commented Jul 27, 2022

目前观察到的情况是,在「把 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

@x6-bot
Copy link
Contributor

x6-bot bot commented Aug 18, 2023

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.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug 缺陷 Defects and unexpected behaviors
Projects
None yet
2 participants