chiark / gitweb /
drag select: drag, make less funky
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Apr 2021 00:27:11 +0000 (01:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Apr 2021 00:34:54 +0000 (01:34 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index ab61445ad207a6f02a00022418527879e6dbe0cd..14d1d8f18dddad0ae153f3e82939ec841fd8f37f 100644 (file)
@@ -1256,10 +1256,15 @@ function rectsel_mousemove(e: MouseEvent) {
   if (pos2 == null) {
     path = "";
   } else {
-    path = `M ${ rectsel_start! [0]} ${ rectsel_start! [1] }
-              ${ pos2           [0]} ${ rectsel_start! [1] }
-              ${ pos2           [0]} ${ pos2           [1] }
-              ${ rectsel_start! [0]} ${ pos2           [1] } Z`;
+    let pos1 = rectsel_start!;
+    path = `M ${ pos1 [0]} ${ pos1 [1] }
+              ${ pos2 [0]} ${ pos1 [1] }
+            M ${ pos1 [0]} ${ pos2 [1] }
+              ${ pos2 [0]} ${ pos2 [1] }
+            M ${ pos1 [0]} ${ pos1 [1] }
+              ${ pos1 [0]} ${ pos2 [1] }
+            M ${ pos2 [0]} ${ pos1 [1] }
+              ${ pos2 [0]} ${ pos2 [1] }`;
   }
   rectsel_path.firstElementChild!.setAttributeNS(null,'d',path);
 }