diff --git a/packages/extension/src/dynamic-group/node.ts b/packages/extension/src/dynamic-group/node.ts index 8ad489bb0..9af391fa7 100644 --- a/packages/extension/src/dynamic-group/node.ts +++ b/packages/extension/src/dynamic-group/node.ts @@ -112,9 +112,16 @@ export class DynamicGroupNode< data, }: Omit, 'e' | 'position'>) => { const { model: curGroup, graphModel } = this.props + const { transformModel } = graphModel + const { SCALE_X, SCALE_Y } = transformModel if (data.id === curGroup.id) { const nodeIds = this.getNodesInGroup(curGroup, graphModel) - graphModel.moveNodes(nodeIds, deltaX, deltaY, true) + // https://github.com/didi/LogicFlow/issues/1914 + // 当调用lf.fitView()时,会改变整体的SCALE_X和SCALE_Y + // 由于group的mousemove是在drag.ts的this.onDragging()处理的,在onDragging()里面进行SCALE的处理 + // 而"node:mousemove"emit出来跟onDragging()是同时的,也就是emit出来的数据是没有经过SCALE处理的坐标 + // 因此这里需要增加SCALE的处理 + graphModel.moveNodes(nodeIds, deltaX / SCALE_X, deltaY / SCALE_Y, true) } }