@@ -6,7 +6,13 @@ import type {
6
6
CanvasEventBusEvents ,
7
7
ConnectStartEvent ,
8
8
} from ' @/types' ;
9
- import type { Connection , XYPosition , NodeDragEvent , GraphNode } from ' @vue-flow/core' ;
9
+ import type {
10
+ Connection ,
11
+ XYPosition ,
12
+ NodeDragEvent ,
13
+ NodeMouseEvent ,
14
+ GraphNode ,
15
+ } from ' @vue-flow/core' ;
10
16
import { useVueFlow , VueFlow , PanelPosition , MarkerType } from ' @vue-flow/core' ;
11
17
import { MiniMap } from ' @vue-flow/minimap' ;
12
18
import Node from ' ./elements/nodes/CanvasNode.vue' ;
@@ -272,6 +278,14 @@ function onNodeDragStop(event: NodeDragEvent) {
272
278
onUpdateNodesPosition (event .nodes .map (({ id , position }) => ({ id , position })));
273
279
}
274
280
281
+ function onNodeClick({ event , node }: NodeMouseEvent ) {
282
+ if (event .ctrlKey || event .metaKey || selectedNodes .value .length < 2 ) {
283
+ return ;
284
+ }
285
+
286
+ onSelectNodes ({ ids: [node .id ] });
287
+ }
288
+
275
289
function onSelectionDragStop(event : NodeDragEvent ) {
276
290
onUpdateNodesPosition (event .nodes .map (({ id , position }) => ({ id , position })));
277
291
}
@@ -676,6 +690,7 @@ provide(CanvasKey, {
676
690
@move-start =" onPaneMoveStart"
677
691
@move-end =" onPaneMoveEnd"
678
692
@node-drag-stop =" onNodeDragStop"
693
+ @node-click =" onNodeClick"
679
694
@selection-drag-stop =" onSelectionDragStop"
680
695
@dragover =" onDragOver"
681
696
@drop =" onDrop"
0 commit comments