chiark / gitweb /
cleanups for wresting/pinning
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 3 Oct 2020 10:46:29 +0000 (11:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 3 Oct 2020 10:46:29 +0000 (11:46 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index 7eb4ce7a74cc2271e56f52a73dea8547c2a40861..940bed1e48a69c480d1b129d5d9cdf095a5d4b27 100644 (file)
@@ -419,11 +419,10 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
   var piece = target.dataset.piece!;
   if (!piece) { return; }
   let p = pieces[piece]!;
-  if (p.pinned && !wresting && p.held!=us) return;
-  drag_cancel();
-
   let held = p.held;
 
+  drag_cancel();
+
   drag_pieces = [];
   if (held == us) {
     dragging = DRAGGING.MAYBE_UNGRAB;
@@ -434,7 +433,11 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
       if (tp.held != us) continue;
       drag_add_piece(tpiece,tp);
     }
-  } else if (held == null || wresting) {
+  } else if (held == null) {
+    if (p.pinned && !wresting) {
+      add_log_message('That piece is pinned to the table.');
+      return;
+    }
     if (!shifted) {
       ungrab_all();
     }