chiark / gitweb /
js: Do grab before drag
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Apr 2021 22:42:24 +0000 (23:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Apr 2021 22:42:24 +0000 (23:42 +0100)
This is more consistent and will enable better refactoring

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index 60b07c41c850a30a6c16522e1c1b5c7458128810..6168baf237fa402fcebc6cbe2efbc7a8de19e888 100644 (file)
@@ -1013,6 +1013,7 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
       add_log_message('That piece is pinned to the table.');
       return;
     }
+    grab_clicked(clicked);
     dragging = DRAGGING.MAYBE_GRAB;
     let for_drag = note_already
        ? Object.keys(note_already).concat(clicked)
@@ -1025,7 +1026,6 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
                                              +SPECIAL_MULTI_DELTA_MAX);
       drag_add_piece(piece,p);
     }
-    grab_clicked(clicked);
   } else {
     add_log_message('That piece is held by another player.');
     return;