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-04-30 10:17:45 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-30 10:17:45 -0700 |
commit | 82d3a4b415ba920176058d615b697e84a49adabc (patch) | |
tree | 7bc250d9f332689e3dc0c4e7aec5949175a0f9fa /src/map.js | |
parent | a4888a3e0905f3561781cb0ef4686befc0dff122 (diff) |
Create record sheet dynamically when map is loaded
Diffstat (limited to 'src/map.js')
-rw-r--r-- | src/map.js | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -4,16 +4,23 @@ 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'); if ('cols' in dataset && 'rows' in dataset) { const cellTemplate = svg.querySelector('#hex'); - const grid = gb.querySelector('.grid'); createCells(grid, dataset, cellTemplate.id); } -setElAttrs(bg, calcComputedBboxFor(imageMaps)); +const sequence = getComputedStyle(gb).transform.match(/-?\d+\.?\d*/g); +const mtx = new DOMMatrix(sequence || ''); +bg.style.transform = mtx; + +const bbox = grid.getBBox(); + +bbox.height += 5; + +setElAttrs(bg, bbox); svg.setAttribute('viewBox', formatForViewBox(calcComputedBboxFor(gb))); function setElAttrs(el, attrs) { |