index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-06-28 15:10:28 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-06-28 15:10:28 -0700 |
commit | 83457c5218047584d2d9e8210060b64b10739de0 (patch) | |
tree | 151f83ed97176a83da3aff5cb2b1111512b44991 /src/modules/game/soldier.js | |
parent | ade861767b9961590ba31ca6ba30be1ca8346ea1 (diff) |
Update deleteClone for cube coords
Diffstat (limited to 'src/modules/game/soldier.js')
-rw-r--r-- | src/modules/game/soldier.js | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js index 12adf6b..f9c67db 100644 --- a/src/modules/game/soldier.js +++ b/src/modules/game/soldier.js @@ -9,16 +9,9 @@ function traceSelector(counter) { } function getCellPosition(cell) { - let pt = new DOMPoint(0, 0), - transform = getComputedStyle(cell).transform.match(/-?\d+\.?\d*/g), - mtx = new DOMMatrix(transform); - pt = pt.matrixTransform(mtx); + const [x, y] = cell.getAttributeNS(null, 'transform').match(/-?\d+\.?\d*/g); - transform = getComputedStyle(cell.parentElement).transform.match(/-?\d+\.?\d*/g); - mtx = new DOMMatrix(transform); - pt = pt.matrixTransform(mtx); - - return pt; + return { x, y }; } function getClones(svg, counter) { @@ -35,12 +28,9 @@ function addMoveToHistory(selected) { } function updatePlacement(cell, selected, clone) { - const prevCoords = [ - clone.parentElement.dataset.x, - clone.parentElement.parentElement.dataset.y - ] + const { q, r, s, t } = clone.parentElement.dataset; - selected.dataset.previous = prevCoords; + selected.dataset.previous = [q, r, s, t]; cell.appendChild(selected); Array.from(selected.children).forEach(n => { |