From ac3740d4059054dd434b29a572d433d93418ecdb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 25 Mar 2021 16:41:18 +0000 Subject: [PATCH] script: Show pieces with solid line when over occulted Signed-off-by: Ian Jackson --- templates/script.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index f745b091..3f0b7d1b 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -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); } } -- 2.30.2