chiark / gitweb /
script: Show pieces with solid line when over occulted
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Mar 2021 16:41:18 +0000 (16:41 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Mar 2021 16:41:18 +0000 (16:41 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index f745b0913c63ffb12f6e629f59236bd13916fbe2..3f0b7d1b98b9c7d93e4cfb48ae14ba7b4dbfc9aa 100644 (file)
@@ -815,9 +815,19 @@ function redisplay_ancillaries(piece: PieceId, p: PieceInfo) {
     p.pelem.prepend(nelem);
   } 
   if (p.held != null) {
-    let da = players[p.held!]!.dasharray;
+    let us_inoccult = false;
+    if (p.held == us) {
+      let [px, py] = piece_xy(p);
+      if (occregions.contains_pos(px, py)) {
+       us_inoccult = true;
+      }
+    }
     let nelem = ancillary_node(piece, held_surround_colour);
-    nelem.setAttributeNS(null,'stroke-dasharray',da);
+    if (!us_inoccult) {
+      let da = players[p.held!]!.dasharray;
+      nelem.setAttributeNS(null,'stroke-dasharray',da);
+    }
+    p.held_us_inoccult = us_inoccult;
     p.pelem.appendChild(nelem);
   }
 }