Skip to content

Commit

Permalink
fix: 修复问题:开启snapline后,当我们框选圆形组件、node2矩形组件(node2中有一个node3被embedding时),…
Browse files Browse the repository at this point in the history
…translateby是node2时,导致node2和组合在一起的node3移动错乱,并且node1移动错误的bug
  • Loading branch information
wqgs2004214 committed Nov 1, 2024
1 parent 6437549 commit f0d5f07
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit f0d5f07

Please sign in to comment.