From: Ian Jackson Date: Thu, 25 Mar 2021 16:41:18 +0000 (+0000) Subject: script: Show pieces with solid line when over occulted X-Git-Tag: otter-0.5.0~414 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ac3740d4059054dd434b29a572d433d93418ecdb;p=otter.git script: Show pieces with solid line when over occulted Signed-off-by: Ian Jackson --- 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); } }