Add per-map editable markers and backups

This commit is contained in:
lucio committed 2026-08-08 22:03:49 -07:00
1 parent e71447da5d
commit bbb4cadddd
23 files changed
+11090 -129

No files matched your search

+50 -6
View File
@@ -368,16 +368,60 @@ of the map's geometry, zoom range and source file stamp — see §11.
marker pixels. Visible leaves in on-map overlay/marker groups are classified,
normalized against the configured crop, and deduplicated when a PSD icon and
text component share the same point. Legends, credits, titles, compass art and
large region overlays are excluded. The generated `web/data/markers.json`
contains `{mapId, x, y, category, label, source}` records.
large region overlays are excluded. Each generated
`web/data/markers/<map-id>.json` contains only that map's
`{mapId, x, y, category, label, source}` records.
`tools/render_marker_audit.py` composites all visible PSD layers, uses the
configured crop for both panes, and produces one side-by-side comparison per
map plus a contact sheet. This is the visual QA step for finding off-map
records, helper/legend artifacts, missing names, and PMC/Scav/shared/hidden
extract role mismatches. Source PSDs and generated map tiles are never changed.
The viewer converts normalized coordinates through each map's current
`origin`/`size`, so placement and stretch changes also move the marker layer.
One **Markers** control toggles the complete layer. Focus limits rendering to
the active parent/sub-map family, while consistent CSS category symbols remain
visible at broad zooms and labels appear from zoom 6.
One **Markers** control toggles the complete layer, while the grouped category
controls toggle individual marker types. Visibility choices are saved in local
browser storage. Hover tooltips show the marker name, category and source map.
`web/app.js`, 179 lines, no build step, no framework, vendored Leaflet.
**Marker edit** enables existing markers as draggable Leaflet markers. Clicking
one opens its label and category fields; dragging persists normalized map-local
coordinates. **Drop new marker** creates a draggable draft that is written only
after its label and category are confirmed. `/api/marker` stores extracted
marker changes as overrides, new markers as additions, and deletions as default
marker ID tombstones in
`web/data/marker-edits/<map-id>.json`; it never rewrites the corresponding
generated marker file. Deleting a user-added marker removes only that addition.
`tools/backup_markers.py` copies every current generated map file into
`web/data/marker-defaults/`, refuses to overwrite a differing snapshot, and
marks each backup read-only. Neither the viewer nor the server API has a write
path to this directory, preserving a restoration source independent of future
extraction runs.
`web/data/marker-config.json` controls each category's group, label, color,
size, symbol (plain text or emoji), visible text and default visibility. Its
defaults also control the text-label zoom, spatial-index cell size and viewport
padding. At runtime, `web/app.js` indexes records into world-space grid cells,
queries only cells intersecting the padded viewport, and reconciles that small
result with the currently rendered Leaflet markers. Focus fetches only the
active parent/sub-map family and unloads the previous family's records. A child
is always loaded with its root map, so Customs includes Dorms and Shoreline
includes Resort without requiring a second selection.
Extract categories have their own earlier label threshold and higher stacking
order. They are visible by default; noisy bulk categories start hidden but
remain individually toggleable. `visibilityVersion` provides a clean default
set when those defaults change without overwriting later user choices.
After viewport marker reconciliation, a label-layout pass reserves marker,
panel and already-placed label rectangles in a small spatial grid. It searches
bounded nearby positions, prioritizes extracts, and draws a short leader line
when a label must move away from its icon. Icon avoidance is relaxed before a
label is ever sent far from its marker. Layout reruns after marker, viewport or
panel-size changes without rebuilding the marker index.
The viewer has no build step or framework and uses vendored Leaflet.
### Layers