fix(core): handle pointer capture for selection on drag (#1543)
* fix(core): handle pointer capture for selection on drag * chore(changeset): add
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@vue-flow/core": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Handle pointer capture for selection on drag
|
||||||
@@ -114,7 +114,7 @@ function onWheel(event: WheelEvent) {
|
|||||||
|
|
||||||
function onPointerDown(event: PointerEvent) {
|
function onPointerDown(event: PointerEvent) {
|
||||||
containerBounds.value = vueFlowRef.value?.getBoundingClientRect()
|
containerBounds.value = vueFlowRef.value?.getBoundingClientRect()
|
||||||
container.value?.setPointerCapture(event.pointerId)
|
;(event.target as Element)?.setPointerCapture?.(event.pointerId)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!elementsSelectable.value ||
|
!elementsSelectable.value ||
|
||||||
@@ -147,6 +147,7 @@ function onPointerDown(event: PointerEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userSelectionActive.value = true
|
userSelectionActive.value = true
|
||||||
|
nodesSelectionActive.value = false
|
||||||
|
|
||||||
emits.selectionStart(event)
|
emits.selectionStart(event)
|
||||||
}
|
}
|
||||||
@@ -215,7 +216,7 @@ function onPointerUp(event: PointerEvent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
container.value?.releasePointerCapture(event.pointerId)
|
;(event.target as Element)?.releasePointerCapture(event.pointerId)
|
||||||
|
|
||||||
// We only want to trigger click functions when in selection mode if
|
// We only want to trigger click functions when in selection mode if
|
||||||
// the user did not move the mouse.
|
// the user did not move the mouse.
|
||||||
@@ -223,7 +224,9 @@ function onPointerUp(event: PointerEvent) {
|
|||||||
onClick(event)
|
onClick(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesSelectionActive.value = prevSelectedNodesCount.value > 0
|
if (prevSelectedNodesCount.value > 0) {
|
||||||
|
nodesSelectionActive.value = true
|
||||||
|
}
|
||||||
|
|
||||||
resetUserSelection()
|
resetUserSelection()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user