Browse Source

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

mj-deploy
Vašek Šraier 4 years ago
parent
commit
812e2ca6be
  1. 2
      frontend/src/Editor.svelte
  2. 5
      frontend/src/Graph.svelte

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

5
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<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);