Web Dev Solutions

Catalin Mititiuc

From 5763dccbde60e29a72cfc5bcac16db6a22edf4e7 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Mon, 15 Jul 2024 14:58:53 -0700 Subject: WIP: Render buildings already in gameboard when scenario is loaded --- src/radial.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/radial.js') diff --git a/src/radial.js b/src/radial.js index b459ad0..09037ab 100644 --- a/src/radial.js +++ b/src/radial.js @@ -197,7 +197,7 @@ function drawBuildings(buildings, container, { q: pq, r: pr, s: ps }, features) buildingStructure.setAttributeNS(null, 'transform', transform(x, y)); const [mapsheet] = container.classList; - document.querySelector(`.buildings .${mapsheet}`).appendChild(buildingStructure); + document.querySelector(`.buildings .${mapsheet}`).prepend(buildingStructure); building.elevationLevels.forEach(elevationLevel => { const hexContainer = document.createElementNS(xmlns, 'g'); @@ -399,7 +399,7 @@ sheets = msGrps.map(msG => { }, new Map()); const { q: dq, r: dr, s: ds } = toRad(bld.dataset); - let position // = bld.dataset.rotate ? rotate180({ q: +dq, r: +dr, s: +ds }) : ({ q, r, s }) => ({ q: q + +dq, r: r + +dr, s: s + +ds }); + let position; if (bld.dataset.rotate) position = rotate180({ q: +dq, r: +dr, s: +ds }); @@ -426,7 +426,6 @@ sheets = msGrps.map(msG => { }); }); -const scenarioMapsheets = document.querySelectorAll('.grid [class^="mapsheet"]'); document.querySelectorAll('use[href^="#building"]').forEach(el => el.remove()); let finalGrid = new Map(); -- cgit v1.2.3