From c0fe0407380f51c83178991f5f3719eab5452559 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Sat, 13 Jul 2024 11:44:13 -0700
Subject: Add special transform for building 4, mapsheet 1
---
src/radial.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
(limited to 'src/radial.js')
diff --git a/src/radial.js b/src/radial.js
index 6ad04b0..547c0ea 100644
--- a/src/radial.js
+++ b/src/radial.js
@@ -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'),
--
cgit v1.2.3