Commit build outputs via LFS; right-click markers, inline edit box, panel pin

Make a fresh clone servable after `git lfs pull` alone, and rebuildable with
`tools/build.py` without re-rendering unchanged PSDs:

- Track build/ (rendered base PNGs, previews, world composites), web/tiles/,
  web/tiles-trimmed/, web/data/world.json and web/data/markers/. Large PNGs
  and the tile pyramids go through Git LFS (.gitattributes); JSON stays plain.
- build.py: decide PSD re-export from build/<id>/base.stamp.json (PSD size,
  mtime, SHA-256 recorded at export time) instead of file mtimes, which are
  meaningless after an LFS checkout. Same size + new mtime hashes once and
  refreshes the stamp; --stamp-only writes stamps for existing base.pngs.
- Ignore .DS_Store and .env files; track sources/**/*.jpg through LFS.

Viewer:
- Right-click (long-press) the map for a category menu that drops a draft
  marker under the pointer and enters marker edit mode for that map.
- Marker editing moves out of the side panel into a box anchored next to the
  marker: Enter or a left click anywhere else saves, Esc cancels, Delete
  inside the box; drags save position plus the box contents.
- Maps panel expands on hover, header click pins/unpins (status shown in the
  header), unpinned collapses 2 s after the pointer leaves; Overview is the
  first list entry instead of a separate button. Only the panel scrolls; the
  page never grows past the viewport. Hover tooltips render above markers.

Also includes the pending source additions (overall square base, skirt
textures, AI regeneration tooling and notes), service worker, Caddyfile and
map config updates.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5 committed 2026-08-22 09:46:02 -07:00
1 parent 234dc32c86
commit 472c983287
10884 files changed
+48384 -351

No files matched your search

+93 -10
View File
@@ -226,7 +226,7 @@ at the end.
### `tile.py` — place, pad, cut
Crops, scales to the world size implied by `place`, pads to the cell boundary,
and writes WebP tiles (quality 82, method 4). Fully-transparent tiles are
and writes WebP tiles (quality 78, method 5). Fully-transparent tiles are
skipped; fully-opaque tiles are written as RGB rather than RGBA.
It refuses to tile a map larger than one cell with an actionable message.
@@ -300,6 +300,8 @@ around 8 GB for the largest PSDs.
| `minZoom` | no | Raise the automatically derived zoom at which a nested detail layer appears |
| `place` | yes | `{cx, cy, w, h?}`: center anchor and dimensions in **rotated** overall-map pixels |
| `pxPerMeter` | no | From the map's scale bar; recorded for future use |
| `skirt` | no | EXPERIMENTAL: `{image, scale?, featherIn?, fadeOut?, matchColours?}` — AI terrain texture baked around the playable polygon in the trimmed pyramid; generated by `tools/skirt.py` (MiniMax `mmx`). See README → *Experimental: AI-generated skirts* |
| `background` | no | Colour baked under the artwork at tile time — only where there is artwork, grown by `halo` source px and feathered, at `opacity`. A string (`"#5c6168"`) or `{color, halo?: 48, opacity?: 1}`. For floor plans drawn on transparency (Factory) |
| `trim` | no | `{points, outsideTransparency}` playable-area polygon; see below |
| `parent` | no | parent map id for grouped navigation and dropdown ordering |
@@ -385,9 +387,13 @@ controls toggle individual marker types. Visibility choices are saved in local
browser storage. Hover tooltips show the marker name, category and source map.
**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
one opens an edit box anchored next to it (a Leaflet popup in its own pane)
with the label, category and a delete button; Enter or a left click anywhere
outside the box saves, Escape cancels. Dragging persists normalized map-local
coordinates. Right-clicking the map opens a category menu that creates a
draggable draft at the pointer (entering marker edit mode for the map under it)
and opens the same box; **Drop new marker** does the same with a click. A draft
is written only when its box is committed. `/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
@@ -472,15 +478,89 @@ Measured at DPR 1.5, in source pixels per device pixel (higher is sharper):
| Below native level | 0.56 | **1.33** |
| At native level | 0.67 | 0.67 |
It costs roughly 4× the tiles in view (~17 KB each), which is a fair trade on a
LAN. The boost switches itself off on a 1:1 display with integer zoom.
It costs roughly 4× the tiles in view (~17 KB each) in DOM nodes, decodes and
bytes, so it is conditional: on above DPR 1.05 in Auto, always on in Sharp,
always off in Fast (see *Performance profile*). A 1:1 display in Auto accepts
at most a 1.19× stretch at quarter zooms.
### Performance profile
`app.js` derives `PERF` and `DENSITY_BOOST` from a *Detail* mode
(`localStorage` key `tarkov-quality`: `auto` | `fast` | `sharp`; the panel
button cycles it and reloads, because tile size and layer options are fixed at
layer creation):
| | Auto | Fast | Sharp |
| --- | --- | --- | --- |
| density boost | DPR > 1.05 | off | on |
| `fadeAnimation` | on | off | on |
| `updateWhenIdle` | `L.Browser.mobile` | on | `L.Browser.mobile` |
| `updateInterval` / `keepBuffer` | 200 ms / 2 | 400 ms / 1 | 200 ms / 2 |
| cache-warm depth | z ≤ 5 | z ≤ 4 | z ≤ 5 |
Auto becomes Fast on a low-end device (`deviceMemory` ≤ 4, `hardwareConcurrency`
≤ 2) or a slow connection (`saveData`, 2G/3G); warming is skipped on slow
connections. The base layer always loads mid-pan (`updateWhenIdle: false`).
Independent of mode:
- **Low-res underlay** — a second `OffsetTileLayer` per detail map with
`maxNativeZoom` capped at `PERF.previewLevel` (4), `updateWhenIdle`,
`keepBuffer 4`, `zIndex 0` in the same pane (`.tile-preview`). Its container
is set to opacity 1 on the main layer's `loading` event and 0 on `load`, so
a trimmed map's translucent margin never stacks twice once real tiles are
in. Created before the main layer so its few requests leave first; URL and
version follow `setLayerSource`.
- **Cache warming** — `precacheUrls()` reproduces `tile.py`'s grid maths
(`pad · scale / tileSize`) from `world.json` and fetches every map's shallow
levels at idle (`requestIdleCallback`, two in flight, `priority: 'low'`,
paused between `movestart` and `moveend`). Empty tiles inside the bounding
box 404 and are ignored. A `tarkov-precache` stamp (versions + time) skips
the pass for a week.
- **Per-frame work** — `updatePreviewTransforms` iterates only `movedPreviews`
(maps whose placement preview differs from the saved geometry), so outside
the placement editor the `move`/`zoom` handler is a no-op. `focus()` returns
early when the focused family is unchanged (it used to re-stack every pane
and re-fetch the family's marker files on every `moveend`).
`updateMarkerDensity` runs on `zoomend`. `createTile` sets
`decoding = 'async'`.
- **Markers** — `layoutMarkerLabels` resets all labels first (writes) and then
measures (reads); returns early when no label class is active; indexes icon
rectangles in the same cell grid as labels (`makeRectIndex`) instead of a
linear `some()` per candidate; generates the 8 rings × 16 angles lazily and
stops at the first acceptable spot; reads cached `_poi` parts (label, leader,
size, extract flag, set by `cacheMarkerParts` when a marker is added) instead
of `querySelector` per pass; and decides label visibility from the
container's `marker-labels-visible` / `marker-extract-labels-visible`
classes, mirroring style.css, instead of `getComputedStyle`. `categoryConfig`
is memoised. `refreshMarkers` keeps markers inside `viewportPadding × 3`
through short pans. Each pass is recorded as a `tarkov:marker-labels`
`performance.measure`.
- **Marker size slider** — `#marker-scale-control` (top right; bottom left
under 640 px) sets `--marker-scale` on the map container; `.poi-content` is
`transform: scale(var(--marker-scale))` about its centre, so no icon is
rebuilt. The layout works in visual (scaled) pixels and converts to the
icon's local space when writing styles: `local = size/2 + (visual − point)/scale`.
Tooltip offsets follow the scale. Logarithmic slider, 0.5×–2×, persisted as
`tarkov-marker-scale`; clicking the readout resets to 1×.
- **Service worker** — `web/sw.js`: tiles/vendor cache-first, shell
stale-while-revalidate, `data/*.json` network-first with cache fallback,
`capabilities.json` and `api/` network only. Registered only when
`capabilities.mapEditing` is false; the authoring server unregisters any
existing worker. The page posts the live `version`/`trimmedVersion` list so
tiles from superseded builds are evicted. Needs HTTPS or `localhost`.
### Other behaviour
- URL hash `#zoom/y/x` for shareable positions.
- Map picker; the active map is marked.
- `window.tarkovMap` / `window.tarkovWorld` exposed for console debugging.
- Non-dismissible attribution control (licence requirement).
- Non-dismissible attribution control (licence requirement), flush in the
bottom-right corner below the zoom buttons (added first; Leaflet stacks
bottom-corner controls upwards).
- Zoom buttons are Leaflet's `<a href="#">` made non-draggable (`draggable =
false`, `dragstart` prevented, `-webkit-user-drag: none`) and styled like the
toolbar buttons — a moving click used to start a ghost-image link drag.
- Mobile: `viewport-fit=cover`, safe-area insets, 44 px touch targets,
collapsible picker, zoom buttons hidden under 640 px in favour of pinch.
@@ -550,8 +630,9 @@ per map view. It now sets HTTP/1.1, which is most of its improvement above.
**Neither serves HTTP/2**: browsers only negotiate h2 over TLS, and trusting a
local CA on every phone is not worth it on a LAN. The Caddy win is Go's I/O.
Cache policy: tiles `public, max-age=604800, immutable`; app shell and
`world.json` `no-cache`.
Cache policy: tiles `public, max-age=31536000, immutable`; app shell,
`sw.js` and `world.json` `no-cache` (a service worker script must never be
served stale — Caddy's `@shell` matcher includes `/sw.js`).
To reach it from a phone, allow the port once (elevated):
@@ -675,7 +756,9 @@ literal `@` to the commit message. Use a heredoc with `git commit -F -`.
| --- | --- | --- |
| XYZ tile pyramid + Leaflet | Standard, mobile gestures free, no client deps | `L.imageOverlay` (39 MP in one request); IIIF/DZI (extra dependency) |
| 256 px tiles | Works cleanly with the density boost (128 CSS px at 2×) | 512 px — fewer requests but coarser boost granularity |
| WebP q82 | ~4× smaller than PNG, alpha supported everywhere in scope | PNG (too large); JPEG (no alpha) |
| Conditional density boost + Detail modes | 4× tiles only where a display can show them; weak devices and slow links get 256 px tiles | Unconditional boost (4× tiles on every 1:1 display) |
| Low-res underlay shown only while loading | "Blurry then sharp" with no double-alpha on trimmed margins | Always-on underlay (stacks translucent margins); nothing (holes while loading) |
| WebP q78 / method 5 | ~4× smaller than PNG, alpha supported everywhere in scope; ~15–20 % smaller than q82 at no visible cost on map art | PNG (too large); JPEG (no alpha); method 6 (~60× slower on RGBA tiles, no smaller) |
| Pad maps onto the grid | Exact placement with an integral tile grid, zero cost | Snapping origins (131 072 px granularity — unusable); one giant baked world raster (gigapixels, rebuild everything per change) |
| Per-map pyramids | Adding a map never re-tiles the others | Single world pyramid |
| Pure-Python pipeline | No native binaries across several machines; 39 MP fits in RAM | libvips `dzsave` (faster, but a native dep) |