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

fix: enabling snapline plugin selecting and moving cells causes position errors #4490

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/x6-plugin-selection/src/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,11 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
if (otherOptions && otherOptions.translateBy) {
const currentCell = this.graph.getCellById(otherOptions.translateBy)
if (currentCell) {
map[currentCell.id] = true
// 问题:开启snapline后,当我们框选圆形组件、node2矩形组件(node2中有一个node3被embedding时),translateby是node2时,导致node2和组合在一起的node3移动错乱,并且node1移动错误的bug
// 解决方法:
// 当我们在translateby == node2时,node3获取到位置改变事件后,需要触发node2的移动,,不应该将node2放到移动排除列表中,这样会导致node2不会移动。
// 我的改造方式是:注释掉代码map[currentCell.id] = true,在embedding时,父控件会跟随子控件位置发生改变

currentCell.getDescendants({ deep: true }).forEach((child) => {
map[child.id] = true
})
Expand Down
Loading