From 812e2ca6bee120d4cf73a0ced12e24661af413e7 Mon Sep 17 00:00:00 2001 From: Vasek Sraier Date: Mon, 5 Oct 2020 21:26:35 +0200 Subject: [PATCH] =?UTF-8?q?editor:=20fixnuto=20p=C5=99esouv=C3=A1n=C3=AD,?= =?UTF-8?q?=20p=C5=99esun=20nod=C5=AF=20by=20default=20aktivn=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/Editor.svelte | 2 +- frontend/src/Graph.svelte | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/Editor.svelte b/frontend/src/Editor.svelte index 7a53067..dceb399 100644 --- a/frontend/src/Editor.svelte +++ b/frontend/src/Editor.svelte @@ -17,7 +17,7 @@ import { isLoggedIn } from "./ksp-task-grabber"; let clicked: string[] = []; let graph: Graph; let currentTask: TaskDescriptor | null = null; - let nodeDraggingEnabled: boolean = false; + let nodeDraggingEnabled: boolean = true; let angle: number; let showHiddenEdges: boolean = false; const { open } = getContext("simple-modal"); diff --git a/frontend/src/Graph.svelte b/frontend/src/Graph.svelte index a0fda88..8925a09 100644 --- a/frontend/src/Graph.svelte +++ b/frontend/src/Graph.svelte @@ -23,6 +23,7 @@ let svgElement: SVGElement; let innerSvgGroup: SVGElement; let selectionRectangle: [[number, number], [number, number]] | null = null; + let dragInProgress: boolean = false; $: nodes = tasks.tasks; $: edges = createEdges(nodes); @@ -49,7 +50,7 @@ function eventHandler(hovering: CustomEvent) { if (hovering.detail) { hoveredTask = task.id; - if (!selection.has(task)) { + if (!selection.has(task) && !dragInProgress) { selection.clear(); selection.add(task); selection = selection; @@ -145,6 +146,7 @@ // is the left button pressed? if (e.button != 0) return; + dragInProgress = true; e.preventDefault(); e.stopPropagation(); @@ -171,6 +173,7 @@ function dragStop(e: MouseEvent) { if (!nodeDraggingEnabled) return; + dragInProgress = false; e.preventDefault(); e.stopPropagation(); window.removeEventListener("mousemove", drag);