fix(core): prevent pane click event when connection is in progress (#1776)
* fix(core): prevent pane click event when connection is in progress 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>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@vue-flow/core": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Prevent pane click event when connection is in progress.
|
||||||
@@ -32,6 +32,7 @@ const {
|
|||||||
nodeLookup,
|
nodeLookup,
|
||||||
connectionLookup,
|
connectionLookup,
|
||||||
defaultEdgeOptions,
|
defaultEdgeOptions,
|
||||||
|
connectionStartHandle,
|
||||||
} = useVueFlow()
|
} = useVueFlow()
|
||||||
|
|
||||||
const container = ref<HTMLDivElement | null>(null)
|
const container = ref<HTMLDivElement | null>(null)
|
||||||
@@ -44,6 +45,8 @@ const containerBounds = ref<DOMRect>()
|
|||||||
|
|
||||||
const hasActiveSelection = toRef(() => elementsSelectable.value && (isSelecting || userSelectionActive.value))
|
const hasActiveSelection = toRef(() => elementsSelectable.value && (isSelecting || userSelectionActive.value))
|
||||||
|
|
||||||
|
const connectionInProgress = toRef(() => connectionStartHandle.value !== null)
|
||||||
|
|
||||||
// Used to prevent click events when the user lets go of the selectionKey during a selection
|
// Used to prevent click events when the user lets go of the selectionKey during a selection
|
||||||
let selectionInProgress = false
|
let selectionInProgress = false
|
||||||
let selectionStarted = false
|
let selectionStarted = false
|
||||||
@@ -79,7 +82,7 @@ function wrapHandler(handler: Function, containerRef: HTMLDivElement | null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onClick(event: MouseEvent) {
|
function onClick(event: MouseEvent) {
|
||||||
if (selectionInProgress) {
|
if (selectionInProgress || connectionInProgress) {
|
||||||
selectionInProgress = false
|
selectionInProgress = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user