chiark / gitweb /
drag box: Fix box to be a box, still rather funky
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Apr 2021 00:22:20 +0000 (01:22 +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/macros.tera
templates/script.ts

index 5dfc94da52c97302f01f6bb514db5d74a6c640f9..eaf65f49d69b646411959cefdf3ff34fce03b2e1 100644 (file)
@@ -91,7 +91,7 @@ Hi {{nick | escape}}
       <use href="#rectsel_path" stroke-width="1.0 "stroke="purple"/>
       <use href="#rectsel_path" stroke-width="0.5" stroke="#fcf"  />
       <defs id ="static_defs">
-      <g id="rectsel_path"><path stroke-dasharray="1 1" d=""/></g>
+      <g id="rectsel_path"><path fill="none" stroke-dasharray="1 1" d=""/></g>
       </defs>
     </svg>
 {% endmacro space %}
index efebe0a9c3a67e6cd84f855cdf9707e37289cd86..ab61445ad207a6f02a00022418527879e6dbe0cd 100644 (file)
@@ -1256,12 +1256,10 @@ function rectsel_mousemove(e: MouseEvent) {
   if (pos2 == null) {
     path = "";
   } else {
-    path = "M";
-    for (let p of [rectsel_start!, pos2]) {
-      for (let i of [0,1]) {
-       path += ` ${ p[i] }`;
-      }
-    }
+    path = `M ${ rectsel_start! [0]} ${ rectsel_start! [1] }
+              ${ pos2           [0]} ${ rectsel_start! [1] }
+              ${ pos2           [0]} ${ pos2           [1] }
+              ${ rectsel_start! [0]} ${ pos2           [1] } Z`;
   }
   rectsel_path.firstElementChild!.setAttributeNS(null,'d',path);
 }