From e0ca242a99bd0865aaeba57c3c17737b58c873f6 Mon Sep 17 00:00:00 2001 From: yugasun Date: Sun, 8 Oct 2023 14:30:17 +0800 Subject: [PATCH] fix: plugin-selection edge selection when moving, close #3084 --- examples/x6-example-features/src/pages/selection/index.tsx | 1 + packages/x6-plugin-selection/src/selection.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/examples/x6-example-features/src/pages/selection/index.tsx b/examples/x6-example-features/src/pages/selection/index.tsx index 4c0328ddd93..4a9480bfe0f 100644 --- a/examples/x6-example-features/src/pages/selection/index.tsx +++ b/examples/x6-example-features/src/pages/selection/index.tsx @@ -21,6 +21,7 @@ export default class Example extends React.Component { multiple: true, strict: true, showNodeSelectionBox: true, + showEdgeSelectionBox: true, selectCellOnMoved: false, filter(cell) { return cell !== a diff --git a/packages/x6-plugin-selection/src/selection.ts b/packages/x6-plugin-selection/src/selection.ts index ea7b53fe350..42b66b19c3e 100644 --- a/packages/x6-plugin-selection/src/selection.ts +++ b/packages/x6-plugin-selection/src/selection.ts @@ -76,6 +76,7 @@ export class SelectionImpl extends View { graph.on('scale', this.onGraphTransformed, this) graph.on('translate', this.onGraphTransformed, this) + graph.on('node:moving', this.onNodeOrEdgeMove, this) graph.model.on('updated', this.onModelUpdated, this) collection.on('added', this.onCellAdded, this) @@ -116,6 +117,10 @@ export class SelectionImpl extends View { this.updateSelectionBoxes() } + protected onNodeOrEdgeMove() { + this.updateSelectionBoxes() + } + protected translating: boolean protected onNodePositionChanged({