chiark / gitweb /
divide mouse buttons
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jul 2020 21:25:44 +0000 (22:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jul 2020 21:25:44 +0000 (22:25 +0100)
templates/script.ts
templates/session.tera

index 4f6eb7579489cd440f35095612cd820c51b8c782..8b18245dababd7c7e861ae57857d086060811398 100644 (file)
@@ -203,8 +203,28 @@ function drag_add_piece(piece: PieceId, p: PieceInfo) {
   });
 }
 
-function drag_mousedown(e : MouseEvent) {
+function some_mousedown(e : MouseEvent) {
   console.log('mousedown', e);
+
+  if (e.button != 0) { return }
+  if (e.altKey) { return }
+  if (e.metaKey) { return }
+  if (e.shiftKey) {
+    if (e.ctrlKey) {
+      return;
+    } else {
+      // group select
+    }
+  } else {
+    if (e.ctrlKey) {
+      // region indication
+    } else {
+      drag_mousedown(e);
+    }
+  }
+}
+
+function drag_mousedown(e : MouseEvent) {
   var target = e.target as SVGGraphicsElement; // we check this just now!
   var piece = target.dataset.piece!;
   if (!piece) { return; }
index 953fe44331d83f86787a306463cf4555c318b8f8..3775f02bd55780ac1fcc3d7ee9e7feaf12eb6b76 100644 (file)
@@ -12,7 +12,7 @@
 <p>
     <svg id="space"
         xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 110"
-        onmousedown="drag_mousedown(event)"
+        onmousedown="some_mousedown(event)"
         >
       <rect fill="green" x="20" y="5" width="200" height="100"/>
       <g id="pieces_marker"></g>