From 190600335c28238e83c04b8315ee1e649f9e5694 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 2 Oct 2020 23:21:25 +0100 Subject: [PATCH] mouse stuff Signed-off-by: Ian Jackson --- templates/script.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index 905b9efa..f0c929f4 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -350,22 +350,14 @@ function some_mousedown(e : MouseEvent) { if (e.button != 0) { return } if (e.altKey) { return } if (e.metaKey) { return } - if (e.shiftKey) { - if (e.ctrlKey) { - return; - } else { - // group select - } + if (e.ctrlKey) { + return; } else { - if (e.ctrlKey) { - // region indication - } else { - drag_mousedown(e); - } + drag_mousedown(e, e.shiftKey); } } -function drag_mousedown(e : MouseEvent) { +function drag_mousedown(e : MouseEvent, shifted: boolean) { var target = e.target as SVGGraphicsElement; // we check this just now! var piece = target.dataset.piece!; if (!piece) { return; } @@ -376,6 +368,15 @@ function drag_mousedown(e : MouseEvent) { drag_pieces = []; if (held == null) { + if (!shifted) { + for (let tpiece of Object.keys(pieces)) { + let tp = pieces[tpiece]!; + if (tp.held == us) { + set_ungrab(tpiece,tp); + api_piece(api, 'ungrab', tpiece,tp, { }); + } + } + } dragging = DRAGGING.MAYBE_GRAB; drag_add_piece(piece,p); set_grab(piece,p, us); -- 2.30.2