chiark / gitweb /
js: Properly handle shift-click deselection
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Apr 2021 22:41:22 +0000 (23:41 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Apr 2021 22:41:22 +0000 (23:41 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index fd309091589c713686aa7f4699f94881eb625a10..60b07c41c850a30a6c16522e1c1b5c7458128810 100644 (file)
@@ -987,6 +987,13 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
 
   drag_pieces = [];
   if (held == us) {
+    if (shifted) {
+      for (let tpiece of clicked) {
+       let tp = pieces[tpiece]!;
+       do_ungrab(tpiece,tp);
+      }
+      return;
+    }
     dragging = DRAGGING.MAYBE_UNGRAB;
     // contrive to have these first
     for (let piece of clicked) {