Web Dev Solutions

Catalin Mititiuc

From e627dfc3a9254c4aed5f26bd16aa4647035b5c8a Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Mon, 17 Jun 2024 18:27:41 -0700 Subject: Add a building --- public/radial.html | 185 +++++++++++++++++++++++++++++++++++++++-------------- src/radial.js | 36 +++++++++-- 2 files changed, 167 insertions(+), 54 deletions(-) diff --git a/public/radial.html b/public/radial.html index 9dbee63..784040e 100644 --- a/public/radial.html +++ b/public/radial.html @@ -1,52 +1,139 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/src/radial.js b/src/radial.js index 1b015e9..5a9f875 100644 --- a/src/radial.js +++ b/src/radial.js @@ -168,9 +168,11 @@ const buildingCoords = [ generateRadialCoordsRect({ rows: 8, columns: 4, odd: true }, { q: 4, r: 3, s: -7 }), generateRadialCoordsRect({ rows: 8, columns: 4, odd: true }, { q: -5, r: 3, s: 2 }), generateRadialCoordsRect({ rows: 6, columns: 3, equal: false }, { q: -12, r: 3, s: 9 }), - generateRadialCoordsRect({ rows: 8, columns: 4 }, { q: 10, r: 3, s: -13 }), - generateRadialCoordsRect({ rows: 3, columns: 1 }, { q: 9, r: 7, s: -16 }), - generateRadialCoordsRect({ rows: 5, columns: 1, odd: true }, { q: 5, r: 6, s: -11 }), + + // hex building + // generateRadialCoordsRect({ rows: 8, columns: 4 }, { q: 10, r: 3, s: -13 }), + // generateRadialCoordsRect({ rows: 3, columns: 1 }, { q: 9, r: 7, s: -16 }), + // generateRadialCoordsRect({ rows: 5, columns: 1, odd: true }, { q: 5, r: 6, s: -11 }), ] buildingCoords.forEach(building => building.forEach(coords => grid.delete(coords))); @@ -214,5 +216,29 @@ drawHexes(elevation1, grid); buildings.appendChild(bldElevationBasement); buildings.appendChild(bldElevation1); buildings.appendChild(bldElevation2); -svg.appendChild(elevation1); -svg.appendChild(buildings); + +const buildingBlah = svg.querySelector('#building2'); + +const bld2grid = document.createElementNS(xmlns, 'g'); +drawHexes(bld2grid, generateRadialCoordsRect({ rows: 9, columns: 4, odd: true, equal: false }, { q: 4, r: -4, s: 0 })); +drawHexes(bld2grid, generateRadialCoordsRect({ rows: 5, columns: 1 }, { q: 3, r: -1, s: -2 })); +drawHexes(bld2grid, generateRadialCoordsRect({ rows: 5, columns: 1, odd: true }, { q: -2, r: -1, s: 3 })); + +const bld2elvBasement = bld2grid.cloneNode(true); +bld2elvBasement.classList.add('elevation-basement'); +buildingBlah.querySelector('.floor').after(bld2elvBasement); + +const bld2elv1 = bld2grid.cloneNode(true); +bld2elv1.classList.add('elevation-1'); +bld2elvBasement.after(bld2elv1); + +const bld2elv2 = bld2grid.cloneNode(true); +bld2elv2.classList.add('elevation-2'); +bld2elv1.after(bld2elv2); + +const bld2elvRoof = bld2grid.cloneNode(true); +bld2elvRoof.classList.add('elevation-roof'); +bld2elv2.after(bld2elvRoof); + +buildingBlah.before(elevation1); +buildingBlah.before(buildings); -- cgit v1.2.3