Add special transform for building 4, mapsheet 1

This commit is contained in:
2025-06-16 22:41:32 -07:00
parent 2e5d35e8ad
commit 04dc3d9a58
4 changed files with 33 additions and 5 deletions

View File

@@ -624,14 +624,28 @@ sheets = msGrps.map(msG => {
buildings: [...buildings].map(bld => {
const bldId = bld.getAttributeNS(null, 'class');
const bldDef = document.querySelector(`defs #${bldId}`);
// Map-specific footprint definition override
const footprint = bld.querySelector('.footprint') ? bld.querySelectorAll('.footprint g') : bldDef.querySelectorAll('.footprint g');
const grid = [...bldDef.querySelectorAll('.footprint g')].reduce((acc, coordEl) => {
const grid = [...footprint].reduce((acc, coordEl) => {
acc = generateRadialCoords(acc, toRad(coordEl.dataset), toRect(coordEl.dataset), coordEl.dataset.offset);
return acc;
}, new Map());
const { q: dq, r: dr, s: ds } = toRad(bld.dataset);
const 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 // = bld.dataset.rotate ? rotate180({ q: +dq, r: +dr, s: +ds }) : ({ q, r, s }) => ({ q: q + +dq, r: r + +dr, s: s + +ds });
if (bld.dataset.rotate)
position = rotate180({ q: +dq, r: +dr, s: +ds });
else if (bld.dataset.transform)
position = ({ q, r, s }) => ({
q: q + +dq,
r: r + +dr,
s: s + +ds,
transform: (x, y) => `translate(${x + horzSpacing}, ${y})`
})
else
position = ({ q, r, s }) => ({ q: q + +dq, r: r + +dr, s: s + +ds });
return {
type: bld.getAttributeNS(null, 'class'),