From 9e7069ef13137e34c4870f41bb8df8ba2c40dd84 Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Mon, 16 Jun 2025 22:41:28 -0700 Subject: [PATCH] Fix firing arc position --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 80fdd4f..105c4ee 100644 --- a/index.js +++ b/index.js @@ -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);