From c3e1741a4b8ac4c12cf3678cd41c9aa9ff6c61bd Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sun, 25 Dec 2022 17:24:54 +0100 Subject: [PATCH] refactor(core): remove `selectionOnDrag` prop and use `selectionKeyCode` to trigger selection Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- .changeset/cyan-boxes-beam.md | 2 +- examples/vite/src/Basic/Basic.vue | 2 - packages/core/src/container/Pane/Pane.vue | 41 ++++++++++++++++++- .../core/src/container/Viewport/Viewport.vue | 5 ++- .../core/src/container/VueFlow/VueFlow.vue | 1 - packages/core/src/store/state.ts | 1 - packages/core/src/types/flow.ts | 1 - packages/core/src/types/store.ts | 1 - 8 files changed, 44 insertions(+), 10 deletions(-) diff --git a/.changeset/cyan-boxes-beam.md b/.changeset/cyan-boxes-beam.md index c0f8aaf7..d0e7e0e6 100644 --- a/.changeset/cyan-boxes-beam.md +++ b/.changeset/cyan-boxes-beam.md @@ -5,7 +5,7 @@ Allow customizing the controls of the viewport and the selection box. ## Props -- `selectionOnDrag`: Selection box without extra button press (need to set `:pan-on-drag="false"` or `:pan-on-drag="[2]"`[RightClick]). +- `selectionKeyCode`: You can now set this to `MaybeRef` to enable a selection box without extra button press (need to set `:pan-on-drag="false"` or `:pan-on-drag="[2]"`[RightClick]). - `panOnDrag`: Can now be a boolean or a number[], this allows you to configure every mouse button as a drag button. [1, 2] would mean that you can drag via middle and right mouse button. - `panActivationKeyCode`: Key code (or KeyFilter) for activating dragging (useful when using selectionOnDrag). - `selectionMode`: You can choose if the selection box needs to contain a node fully (`SelectionMode.Full`) or partially (`SelectionMode.Partial`) to select. diff --git a/examples/vite/src/Basic/Basic.vue b/examples/vite/src/Basic/Basic.vue index 1c366a56..fd256cc8 100644 --- a/examples/vite/src/Basic/Basic.vue +++ b/examples/vite/src/Basic/Basic.vue @@ -19,8 +19,6 @@ const { onNodeDragStop, onConnect, addEdges, setTransform, toObject } = useVueFl maxZoom: 4, connectOnClick: true, fitViewOnInit: false, - selectionOnDrag: true, - panOnDrag: [2], }) onNodeDragStop((e) => console.log('drag stop', e)) diff --git a/packages/core/src/container/Pane/Pane.vue b/packages/core/src/container/Pane/Pane.vue index 36617aac..03c61341 100644 --- a/packages/core/src/container/Pane/Pane.vue +++ b/packages/core/src/container/Pane/Pane.vue @@ -1,6 +1,7 @@