Lift the focused map above overlapping neighbours; tilt to 35 degrees

Placements are approximate, so map rectangles overlap where the real
locations do not -- Reserve clips Customs, Lighthouse clipped Shoreline.
Sampling the rendered tiles showed the stacking was technically fine
(finer map always on top) but that did not help: an overlapping neighbour
still covered the map you had navigated to.

Stacking is now explicit. Baseline order is by maxNativeZoom then footprint
so the finer map wins, and whichever map the view is centred on is lifted
above everything else. Verified for Shoreline, Lighthouse, Customs, Reserve
and Woods: each becomes topmost when centred.

Tilt raised 31 -> 35 degrees. The original 31 came from fitting the Customs
zone outline's aspect ratio, but that polygon encloses more than the
playable strip so the estimate ran low; attempts to register the two
polygons directly failed because the dashed outline will not flood-fill.
35 aligns better by eye.

`place` lives in the rotated frame, so retilt.py converts every placement
through the old and new angles -- changing the tilt no longer scatters the
maps. Lighthouse's box also tightened; its PSD is nearly square while the
zone is a coastal strip, so it overhung into the sea.

Verified zoom 0-9: 620 tiles, zero broken.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Claude committed 2026-08-08 11:37:15 -07:00
1 parent e8d8738892
commit e656c7c96a
6 files changed
+158 -40

No files matched your search

+28 -3
View File
@@ -79,12 +79,35 @@ async function main() {
const boost = DENSITY_BOOST;
for (const [i, m] of world.maps.entries()) {
/* Stacking. Placements are approximate, so map rectangles overlap even when
* the real locations don't (Reserve clips Customs, Lighthouse clips
* Shoreline). Baseline order puts the finer map on top: sort by
* maxNativeZoom, then by smaller footprint. `focus()` then lifts whichever
* map you are actually looking at above the rest, so an overlapping
* neighbour can never hide the map you came to see. */
const detail = world.maps.filter((m) => !m.base);
const stackOrder = [...detail].sort(
(a, b) => (a.maxNativeZoom - b.maxNativeZoom)
|| (b.size[0] * b.size[1] - a.size[0] * a.size[1]),
);
const BASE_Z = 1;
const baseZ = new Map(stackOrder.map((m, i) => [m.id, 2 + i]));
const TOP_Z = 2 + stackOrder.length;
const layers = new Map();
const focus = (id) => {
for (const [mid, layer] of layers) {
if (mid === base.id) continue;
layer.setZIndex(mid === id ? TOP_Z : baseZ.get(mid));
}
};
for (const m of world.maps) {
// The base map is the backdrop: it is a handful of tiles, always loaded,
// and Leaflet upscales it past its native level -- so a gap while detail
// tiles load shows blurry terrain rather than the page background.
const isBase = !!m.base;
new OffsetTileLayer(`tiles/${m.id}/{z}/{x}/{y}.webp`, {
const layer = new OffsetTileLayer(`tiles/${m.id}/{z}/{x}/{y}.webp`, {
cell: m.cell,
bounds: rectOf(m),
baseTileSize: world.tileSize,
@@ -98,9 +121,10 @@ async function main() {
keepBuffer: isBase ? 6 : 2,
updateWhenIdle: false,
errorTileUrl: BLANK,
zIndex: isBase ? 1 : 2 + i,
zIndex: isBase ? BASE_Z : baseZ.get(m.id),
className: isBase ? 'tile-base' : undefined,
}).addTo(map);
layers.set(m.id, layer);
}
// --- picker -----------------------------------------------------------
@@ -128,6 +152,7 @@ async function main() {
.sort((a, b) => a.size[0] * a.size[1] - b.size[0] * b.size[1])[0];
buttons.forEach((b) => b.setAttribute(
'aria-current', String(hit ? hit.id === b.dataset.id : b.dataset.id === base.id)));
focus(hit?.id);
const z = Math.round(map.getZoom() * 4) / 4;
history.replaceState(null, '', `#${z}/${Math.round(c.lat)}/${Math.round(c.lng)}`);