chiark / gitweb /
click elsewhere, or on pinned piece, deselects all, only unshifted
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Jan 2021 22:19:38 +0000 (22:19 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Jan 2021 22:19:38 +0000 (22:19 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index a9320c1e7e8b7af95764fc2a73f956e2d1d0f521..e5497ae71d52eb2df872aa9b455feab8a1bb9650 100644 (file)
@@ -672,7 +672,9 @@ 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) {
-    ungrab_all();    
+    if (!shifted) {
+      ungrab_all();
+    }
     return;
   }
   let p = pieces[piece]!;
@@ -691,14 +693,13 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
       drag_add_piece(tpiece,tp);
     }
   } else if (held == null || wresting) {
+    if (!shifted) {
+      ungrab_all();
+    }
     if (p.pinned && !wresting) {
       add_log_message('That piece is pinned to the table.');
-      ungrab_all();
       return;
     }
-    if (!shifted) {
-      ungrab_all();
-    }
     dragging = DRAGGING.MAYBE_GRAB;
     drag_add_piece(piece,p);
     set_grab(piece,p, us);