From a8d837bf93fb201b1805a2a8be79ed1084f7aad1 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:14:43 +0200 Subject: [PATCH] fix(core): only capture pointer if valid selection has started (#1565) * fix(core): only capture pointer if valid selection has started Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(changeset): add Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --------- Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- .changeset/honest-deers-thank.md | 5 +++++ packages/core/src/container/Pane/Pane.vue | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/honest-deers-thank.md diff --git a/.changeset/honest-deers-thank.md b/.changeset/honest-deers-thank.md new file mode 100644 index 00000000..54b18fb3 --- /dev/null +++ b/.changeset/honest-deers-thank.md @@ -0,0 +1,5 @@ +--- +"@vue-flow/core": patch +--- + +Only capture pointer when a valid selection has started diff --git a/packages/core/src/container/Pane/Pane.vue b/packages/core/src/container/Pane/Pane.vue index 4661d97a..52d2db5b 100644 --- a/packages/core/src/container/Pane/Pane.vue +++ b/packages/core/src/container/Pane/Pane.vue @@ -115,7 +115,6 @@ function onWheel(event: WheelEvent) { function onPointerDown(event: PointerEvent) { containerBounds.value = vueFlowRef.value?.getBoundingClientRect() - ;(event.target as Element)?.setPointerCapture?.(event.pointerId) if ( !elementsSelectable.value || @@ -127,6 +126,8 @@ function onPointerDown(event: PointerEvent) { return } + ;(event.target as Element)?.setPointerCapture?.(event.pointerId) + const { x, y } = getMousePosition(event, containerBounds.value) selectionStarted = true