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-08-09 20:22:43 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-08-09 20:22:43 -0700 |
commit | a7925db494ab7db102a7acb6408ca5efcbf2cb08 (patch) | |
tree | f0e1abebeff0e259acc32e7cb25c5634d91bd84a /src/map.js | |
parent | 518693844d391b5c0753555b6fafe5810c1c9afb (diff) |
Remove random props on map resource window object
Diffstat (limited to 'src/map.js')
-rw-r--r-- | src/map.js | 30 |
1 files changed, 1 insertions, 29 deletions
@@ -1,16 +1,8 @@ -const svgns = "http://www.w3.org/2000/svg"; -const dataset = document.currentScript.dataset; const svg = document.querySelector('svg'); const gb = svg.querySelector('.gameboard'); const bg = svg.querySelector('#background'); -const imageMaps = svg.querySelector('#image-maps'); const grid = gb.querySelector('.grid'); const dots = gb.querySelector('#dots'); - -const sequence = getComputedStyle(gb).transform.match(/-?\d+\.?\d*/g); -const mtx = new DOMMatrix(sequence || ''); -bg.style.transform = mtx; - const bbox = grid.getBBox(); setElAttrs(bg, bbox); @@ -18,7 +10,7 @@ setElAttrs(dots, bbox) svg.setAttribute('viewBox', formatForViewBox(calcComputedBboxFor(gb))); function setElAttrs(el, attrs) { - for (key in attrs) { + for (const key in attrs) { el.setAttributeNS(null, key, attrs[key]); } } @@ -40,23 +32,3 @@ function calcComputedBboxFor(el) { return { x: originPtX, y: originPtY, width: maxPtX - originPtX, height: maxPtY - originPtY }; } - -function createCells(container, { cols, rows }, templateId) { - for (let rowNum = 0; rowNum < +rows; rowNum++) { - const row = document.createElementNS(svgns, 'g'); - row.dataset.y = rowNum; - - for (let colNum = 0; colNum < +cols; colNum++) { - const cell = document.createElementNS(svgns, 'g'); - cell.dataset.x = colNum; - - const cellShape = document.createElementNS(svgns, 'use'); - cellShape.setAttribute('href', `#${templateId}`); - - cell.appendChild(cellShape); - row.appendChild(cell); - } - - container.appendChild(row); - } -} |