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-05 16:42:26 -0700 |
---|---|---|
committer | Catalin Mititiuc <Catalin.Mititiuc@gmail.com> | 2024-04-05 16:42:26 -0700 |
commit | ea400e2de3ea734a66ae153efdfcc6e96958b5f3 (patch) | |
tree | 72bb5bffc6f6fa05e3891a24d2b58a9ab3537fd1 | |
parent | e8f0dde6da3deb07b507cd34663b815754a98da1 (diff) |
Fix firing arc position
-rw-r--r-- | index.js | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -695,6 +695,11 @@ POINTS.forEach((row, index) => row.forEach(([x, y]) => { group.addEventListener('contextmenu', e => { e.preventDefault(); + + // if the sight line is active + // lock it + // otherwise + // try to draw sightline from active counter to click location let sl = svg.querySelector('.sight-line'); if (sl) { @@ -851,9 +856,11 @@ document.querySelectorAll('.set-firing-arc').forEach(el => el.addEventListener(' let outlineLayer = document.getElementById('lines'); let arcContainer = document.getElementById('firing-arcs'); + let [x, y] = counter.parentElement.getAttribute('transform').match(/-?\d+\.?\d*/g); + let grid = document.getElementById('grid'); const transform = getComputedStyle(grid).transform.match(/-?\d+\.?\d*/g); - const pt = new DOMPoint(counter.getAttribute('x'), counter.getAttribute('y')); + const pt = new DOMPoint(x, y); const mtx = new DOMMatrix(transform); let tPt = pt.matrixTransform(mtx); |