Fix mouse leave deselecting nodes
This commit is contained in:
parent
6f985fd55b
commit
36fa4ece65
1 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@
|
|||
@touchstart="(e: TouchEvent) => mouseDown(e)"
|
||||
@mouseup="() => endDragging(unref(draggingNode))"
|
||||
@touchend.passive="() => endDragging(unref(draggingNode))"
|
||||
@mouseleave="() => endDragging(unref(draggingNode))"
|
||||
@mouseleave="() => endDragging(unref(draggingNode), true)"
|
||||
>
|
||||
<svg class="stage" width="100%" height="100%">
|
||||
<g class="g1">
|
||||
|
@ -223,7 +223,7 @@ function drag(e: MouseEvent | TouchEvent) {
|
|||
}
|
||||
}
|
||||
|
||||
function endDragging(node: BoardNode | null) {
|
||||
function endDragging(node: BoardNode | null, mouseLeave = false) {
|
||||
if (props.draggingNode.value != null && props.draggingNode.value === node) {
|
||||
if (props.receivingNode.value == null) {
|
||||
props.draggingNode.value.position.x += Math.round(dragged.value.x / 25) * 25;
|
||||
|
@ -241,7 +241,7 @@ function endDragging(node: BoardNode | null) {
|
|||
}
|
||||
|
||||
props.setDraggingNode.value(null);
|
||||
} else if (!hasDragged.value) {
|
||||
} else if (!hasDragged.value && !mouseLeave) {
|
||||
props.state.value.selectedNode = null;
|
||||
props.state.value.selectedAction = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue