Skip to content

Commit

Permalink
fix(extension): 【dynamic-group】修复group移动时,没有对组内子节点移动距离进行SCALE计算的问题(di…
Browse files Browse the repository at this point in the history
  • Loading branch information
wbccb committed Oct 19, 2024
1 parent af2cef7 commit a9c3c9a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/extension/src/dynamic-group/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,16 @@ export class DynamicGroupNode<
data,
}: Omit<CallbackArgs<'node:mousemove'>, '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)
}
}

Expand Down

0 comments on commit a9c3c9a

Please sign in to comment.