From f0d5f0779eff9d1666a1ae38323b59a74c4635a3 Mon Sep 17 00:00:00 2001 From: gus <125822741@qq.com> Date: Fri, 1 Nov 2024 15:27:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9A=E5=BC=80=E5=90=AFsnapline=E5=90=8E=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E6=88=91=E4=BB=AC=E6=A1=86=E9=80=89=E5=9C=86=E5=BD=A2=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E3=80=81node2=E7=9F=A9=E5=BD=A2=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=88node2=E4=B8=AD=E6=9C=89=E4=B8=80=E4=B8=AAnode3?= =?UTF-8?q?=E8=A2=ABembedding=E6=97=B6=EF=BC=89,translateby=E6=98=AFnode2?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=AF=BC=E8=87=B4node2=E5=92=8C=E7=BB=84?= =?UTF-8?q?=E5=90=88=E5=9C=A8=E4=B8=80=E8=B5=B7=E7=9A=84node3=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E9=94=99=E4=B9=B1=EF=BC=8C=E5=B9=B6=E4=B8=94node1?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/x6-plugin-selection/src/selection.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/x6-plugin-selection/src/selection.ts b/packages/x6-plugin-selection/src/selection.ts index 349e846509a..536b65cc7a6 100644 --- a/packages/x6-plugin-selection/src/selection.ts +++ b/packages/x6-plugin-selection/src/selection.ts @@ -573,7 +573,11 @@ export class SelectionImpl extends View { 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 })