From 83457c5218047584d2d9e8210060b64b10739de0 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Fri, 28 Jun 2024 15:10:28 -0700
Subject: Update deleteClone for cube coords
---
src/modules/game/soldier.js | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
(limited to 'src/modules/game/soldier.js')
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 => {
--
cgit v1.2.3