sbuffkin_hexmaker/dev
isaprettycoolguy@protonmail.com 0e65565e25 fix: coord labels no longer slip up-left during zoom bake
The bug the user has been chasing for several sessions. Sandbox
repro at dev/coord-slip-sandbox.html, snapshot-coord-slip.mjs
captures the half-baked frame so we can SEE the slip.

Root cause: bakeZoom mutates the viewport font-size mid-function,
which triggers a layout reflow growing every em-based hex
dimension. The path-overlay SVG holds coord labels at pixel
positions computed against the PRE-bake hex sizes, so any paint
frame between the font-size change and the SVG rebuild shows the
labels at where the hexes USED to be — visibly shifted up-left of
the now-larger hexes. updatePathOverlay() further down in bakeZoom
eventually fixes it ("snap back into place"), but the intermediate
slip-then-snap is what the user reported across multiple zoom
sessions.

Fix: tear down the path / faction / region SVGs at the START of
bakeZoom, before the font-size mutation. The CSS rule
`.duckmage-svg-labels-active .duckmage-hex-label { visibility:
hidden }` is keyed off a class on the viewport — that class gets
removed alongside the SVG, so the intermediate paint falls back to
the HTML `.duckmage-hex-label` spans. Those live inside each hex's
own DOM tree, so they always track the hex's layout perfectly
across font-size changes. No slip.

The overlays are then re-rendered later in the function via the
existing updatePathOverlay() / updateFactionOverlay() /
updateRegionOverlay() / updateTokenLayer() calls. Net result: zero
extra rebuild work, just earlier tear-down.

Sandbox confirms:
  buggy-mid: SVG labels visibly shifted up-left of small hexes
  fixed-mid: HTML labels inside hexes, tracking correctly

351 unit tests / 18 e2e pass.
2026-06-21 11:09:12 -04:00
..
.gitignore feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
bg-hex-alignment-sandbox.html fix: grid expand/shrink preserves bg image alignment (1.4.1) 2026-06-17 18:18:53 -04:00
calibration-outline-overlay-sandbox.html feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
coord-slip-sandbox.html fix: coord labels no longer slip up-left during zoom bake 2026-06-21 11:09:12 -04:00
hex-calibration-sandbox.html feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
screenshot-approaches.mjs feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
snapshot-bg-hex-alignment.mjs fix: grid expand/shrink preserves bg image alignment (1.4.1) 2026-06-17 18:18:53 -04:00
snapshot-calibration-outline.mjs feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
snapshot-coord-slip.mjs fix: coord labels no longer slip up-left during zoom bake 2026-06-21 11:09:12 -04:00