index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <Catalin.Mititiuc@gmail.com> | 2024-04-06 11:21:22 -0700 |
---|---|---|
committer | Catalin Mititiuc <Catalin.Mititiuc@gmail.com> | 2024-04-06 11:21:22 -0700 |
commit | ba1e9009a3586dc75456e117ab1d7946d518dd5d (patch) | |
tree | 765b83715d1bc575bd6da986ad0f9cc3c48d1a77 /index.js | |
parent | f73241afb8d80ac942935eb0769c03568b5eb4e7 (diff) |
Avoid hiding firing arc if visibility is toggled when changing unit selection
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -605,8 +605,20 @@ const RecordSheet = new function() { let unclipped = document.querySelectorAll('#firing-arcs polygon:not([clip-path])'); unclipped.forEach(el => { - let { troopNumber, troopAllegiance } = el.dataset; - el.setAttributeNS(null, 'clip-path', `url(#clip-path-${troopAllegiance}-${troopNumber})`); + let { troopNumber, troopAllegiance } = el.dataset, + clipPathId = `clip-path-${troopAllegiance}-${troopNumber}`; + + let isVisible = + document + .getElementById('toggle-firing-arc-vis') + .querySelector(`input[data-allegiance="${troopAllegiance}"]`) + .checked; + + if (isVisible) { + document.getElementById(clipPathId).style.display = 'none'; + } + + el.setAttributeNS(null, 'clip-path', `url(#${clipPathId})`); }); }; |