fix(ui-map): render-on-demand + drop pan inertia (Safari fog freeze, stage 1) #21

Merged
developer merged 1 commits from feature/ui-map-render-on-demand into development 2026-05-20 14:43:57 +00:00
Owner

Problem

The Phase 29 visibility fog ("visible hyperspace") froze the entire UI on
large reports in Safari while staying smooth in Firefox. Root cause: the fog is
a layered overpaint (torus mode = 9 world-sized rects + 9×N near-world-sized
opaque circles — ~270 fills for KNNTS041) and Pixi's continuous auto-render
loop re-rasterised all of it every frame, even while idle. Safari's WebGPU
backend (both Safari and Firefox run WebGPU here) cannot sustain that fillrate,
so the main thread / compositor starved and the whole UI froze.

Stage 1 (this PR) — render-on-demand + no pan inertia

Vector-preserving (no rasterisation):

  • Stop Pixi's auto-render loop (app.stop()); paint on demand via a single
    Ticker.shared flush gated on viewport.dirty (camera) plus an internal
    requestRender() from every content mutation (setVisibilityFog /
    setHiddenPrimitiveIds / setExtraPrimitives / applyMode / resize /
    pick overlay). An idle map does zero GPU work per frame; plain hover
    paints nothing.
  • Remove the decelerate (drag-inertia) plugin: a released drag stops
    instantly and the viewport goes idle immediately.
  • New RendererHandle.getRenderCount() / getMapRenderCount for deterministic
    e2e assertions.

Verification

  • Owner confirmed in Safari: the idle/system freeze is gone, the UI stays
    responsive, drag stops instantly. Firefox unchanged (smooth).
  • Remaining: panning a loaded map with the fog on is still heavy in Safari
    (the overdraw itself is untouched) — addressed next in stage 2 (an
    inverse stencil mask of the circle union, kept vector so the map stays crisp
    at any zoom).

Tests

  • svelte-check clean; Vitest 707/707.
  • New map-toggles e2e specs (idle map does not repaint; released drag does
    not coast) green on all four Playwright projects incl. WebKit.

Docs

  • ui/docs/renderer.md: render-on-demand section; fog section corrected to the
    current single-fogLayer model; FPS note.
  • ui/PLAN.md: Phase 29 decision 8.

🤖 Generated with Claude Code

## Problem The Phase 29 visibility fog ("visible hyperspace") froze the **entire** UI on large reports in Safari while staying smooth in Firefox. Root cause: the fog is a layered overpaint (torus mode = 9 world-sized rects + 9×N near-world-sized opaque circles — ~270 fills for `KNNTS041`) and Pixi's continuous auto-render loop re-rasterised all of it **every frame**, even while idle. Safari's WebGPU backend (both Safari and Firefox run WebGPU here) cannot sustain that fillrate, so the main thread / compositor starved and the whole UI froze. ## Stage 1 (this PR) — render-on-demand + no pan inertia Vector-preserving (no rasterisation): - Stop Pixi's auto-render loop (`app.stop()`); paint on demand via a single `Ticker.shared` flush gated on `viewport.dirty` (camera) plus an internal `requestRender()` from every content mutation (`setVisibilityFog` / `setHiddenPrimitiveIds` / `setExtraPrimitives` / `applyMode` / `resize` / pick overlay). An idle map does **zero** GPU work per frame; plain hover paints nothing. - Remove the `decelerate` (drag-inertia) plugin: a released drag stops instantly and the viewport goes idle immediately. - New `RendererHandle.getRenderCount()` / `getMapRenderCount` for deterministic e2e assertions. ## Verification - Owner confirmed in Safari: the idle/system freeze is **gone**, the UI stays responsive, drag stops instantly. Firefox unchanged (smooth). - Remaining: panning a loaded map with the fog on is still heavy in Safari (the overdraw itself is untouched) — addressed next in **stage 2** (an inverse stencil mask of the circle union, kept vector so the map stays crisp at any zoom). ## Tests - `svelte-check` clean; Vitest 707/707. - New `map-toggles` e2e specs (idle map does not repaint; released drag does not coast) green on all four Playwright projects incl. WebKit. ## Docs - `ui/docs/renderer.md`: render-on-demand section; fog section corrected to the current single-`fogLayer` model; FPS note. - `ui/PLAN.md`: Phase 29 decision 8. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
developer added 1 commit 2026-05-20 14:41:07 +00:00
fix(ui-map): render-on-demand + drop pan inertia to stop the Safari fog freeze
Tests · UI / test (push) Successful in 1m55s
Tests · UI / test (pull_request) Successful in 2m4s
51902b995f
The Phase 29 visibility fog ("visible hyperspace") froze the whole UI on
large reports in Safari while staying smooth in Firefox. Root cause: the
fog is a layered overpaint (torus mode = 9 world-sized rects + 9xN
near-world-sized opaque circles, ~270 fills for KNNTS041) and Pixi's
continuous auto-render loop re-rasterised all of it every frame, even
while idle. Safari's WebGPU backend cannot sustain that fillrate, so the
main thread/compositor starved and the entire UI froze.

Stage 1 (vector-preserving, no rasterisation):

- Stop Pixi's auto-render loop (app.stop()) and paint on demand via a
  single Ticker.shared flush gated on viewport.dirty (camera) plus an
  internal requestRender() from every content mutation (fog / hide-set /
  extras / wrap mode / resize / pick overlay). An idle map now does zero
  GPU work per frame; plain hover paints nothing.
- Remove the decelerate (drag-inertia) plugin: a released drag stops
  instantly (owner request) and the viewport goes idle immediately.
- Expose RendererHandle.getRenderCount() / getMapRenderCount for
  deterministic e2e assertions.

Tests: new map-toggles e2e specs (idle map does not repaint; released
drag does not coast) green on all four Playwright projects incl. WebKit.
Docs: renderer.md (render-on-demand section; fog section corrected to the
current single-fogLayer model; FPS note) and PLAN.md Phase 29 decision 8.

If Safari pan is still heavy after this, stage 2 will cut the overpaint
itself with an inverse stencil mask of the circle union (kept vector).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
developer merged commit 44c18c3ef4 into development 2026-05-20 14:43:57 +00:00
developer deleted branch feature/ui-map-render-on-demand 2026-05-20 14:43:57 +00:00
Sign in to join this conversation.