editor: fixnuto přesouvání, přesun nodů by default aktivní

This commit is contained in:
Vašek Šraier 2020-10-05 21:26:35 +02:00
parent 1dbc3c4fc4
commit 812e2ca6be
2 changed files with 5 additions and 2 deletions

View file

@ -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");

View file

@ -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<boolean>) {
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);