Add permanent trims and semantic map layers

This commit is contained in:
lucio committed 2026-08-08 18:47:56 -07:00
1 parent 3abdc95500
commit e71447da5d
13 files changed
+1929 -114

No files matched your search

+18 -3
View File
@@ -73,7 +73,9 @@ solid fills, so they may need `excludeLayers`.
| `crop` | `[x0, y0, x1, y1]` in PSD pixels, or `null` for the full canvas |
| `minZoom` | optional close-view reveal threshold for nested detail maps; otherwise derived from size |
| `place` | center anchor and dimensions on the world map; optional `h` enables independent stretch — see step 4 |
| `parent` | optional parent map id; groups the sub-map directly below its parent and includes it in parent focus |
| `pxPerMeter` | optional, from the map's scale bar; recorded for later use |
| `trim` | optional normalized playable-area polygon and outside transparency |
---
@@ -158,8 +160,15 @@ python tools/build.py # base + every map
python tools/build.py overall # just retile the base map
python tools/build.py --tiles-only # re-tile after a place/crop change
python tools/build.py --force-export # re-render even if base.png is current
python tools/extract_markers.py <id> # PSD metadata -> semantic marker JSON
```
Marker extraction recognizes visible on-map groups whose paths use names such
as `Overlay`, `OnMap`, `Map Markers`, extracts, spawns, caches and locations.
Keep legends and title furniture in clearly named groups so the extractor can
exclude them. Marker coordinates are stored normalized to the configured crop,
not as raster overlays.
`build.py` skips the PSD render when `base.png` is newer than the PSD, so
iterating on `place` and `crop` is seconds, not minutes.
@@ -186,12 +195,18 @@ grid, and the padding costs nothing.
Each map is also only tiled down to its **native level** — the deepest zoom at
which we are still downscaling its source. Past that the browser upscales,
which looks the same as upscaling during the build but without storing tiles.
`minZoom` likewise stops a map loading while it would be a speck on screen.
The build derives it from the placed size by default. Set it explicitly for a
nested detail view that should stay out of the main view until the user zooms
`minZoom` defaults to 0 so a main map remains visible in the overview. Set it
explicitly for a nested detail view that should stay out of the main view until the user zooms
closer; the configured value can only raise the automatic threshold.
For visual placement, run `pwsh server/run.ps1 -Editable`, select the map in
the viewer, and use **Edit placement**. Dragging the center anchor previews the
move immediately. Width and Height stretch it independently around that anchor;
**Save & rebuild** updates `maps.json` and retiles that map.
Use **Trim area** in the same viewer to add a playable-area polygon. Its points
are normalized to the displayed map, so later placement and stretching do not
invalidate the boundary. **Save trim** updates local configuration, preserves
the PSD, `base.png`, and original tile pyramid, then writes a derived
`build/<id>/trimmed.png` and `web/tiles-trimmed/<id>/` pyramid. The normal
viewer uses the derived copy; the original remains available to edit again.