feat: Implement compatibility bridge for legacy single-SVG callers

- Added compatibility lookups for legacy single-SVG callers to ensure existing workflows function during migration to new architecture.
- Implemented `getLayerSvg`, `getLayerSurface`, and `queryMap` functions as stable globals.
- Migrated relevant code in `draw-state-labels.ts` to utilize the new `queryMap` function for scene-aware lookups.
- Updated `layers.js` to manage layer visibility and registration more effectively.
- Introduced `LayersModule` to handle layer registration, visibility, and ordering.
- Created `WebGLSurfaceLayer` and `SvgLayer` classes to encapsulate layer behavior.
- Refactored `TextureAtlasLayer` to utilize the new layer management system.
- Updated HTML structure to accommodate new SVG and canvas elements.
- Ensured all TypeScript checks pass with zero errors on modified files.
This commit is contained in:
Azgaar 2026-03-13 11:56:07 +01:00
parent 52708e50c5
commit f928f9d101
15 changed files with 613 additions and 305 deletions

View file

@ -120,6 +120,45 @@ compass.append("use").attr("xlink:href", "#defs-compass-rose");
// fogging
fogging.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%");
// bootstrap layers registry
{
const regSvg = (id, el, visible = true) => Layers.register(id, "svg", visible, el.node());
regSvg("ocean", ocean);
regSvg("lakes", lakes);
regSvg("landmass", landmass);
regSvg("texture", texture);
regSvg("terrs", terrs);
regSvg("biomes", biomes);
regSvg("cells", cells);
regSvg("gridOverlay", gridOverlay);
regSvg("coordinates", coordinates);
regSvg("compass", compass, false);
regSvg("rivers", rivers);
regSvg("terrain", terrain);
regSvg("relig", relig);
regSvg("cults", cults);
regSvg("regions", regions);
regSvg("provs", provs);
regSvg("zones", zones);
regSvg("borders", borders);
regSvg("routes", routes);
regSvg("temperature", temperature);
regSvg("coastline", coastline);
regSvg("ice", ice);
regSvg("prec", prec, false);
regSvg("population", population);
regSvg("emblems", emblems, false);
regSvg("icons", icons);
regSvg("labels", labels);
regSvg("armies", armies);
regSvg("markers", markers);
regSvg("ruler", ruler, false);
Layers.register("fogging-cont", "svg", true, document.getElementById("fogging-cont"));
regSvg("debug", debug);
Layers.register("webgl-canvas", "webgl", true, Scene.getCanvas());
}
fogging
.append("rect")
.attr("x", 0)