fix(ui-map): render-on-demand + drop pan inertia (Safari fog freeze, stage 1) #21
Reference in New Issue
Block a user
Delete Branch "feature/ui-map-render-on-demand"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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-renderloop 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):
app.stop()); paint on demand via a singleTicker.sharedflush gated onviewport.dirty(camera) plus an internalrequestRender()from every content mutation (setVisibilityFog/setHiddenPrimitiveIds/setExtraPrimitives/applyMode/resize/pick overlay). An idle map does zero GPU work per frame; plain hover
paints nothing.
decelerate(drag-inertia) plugin: a released drag stopsinstantly and the viewport goes idle immediately.
RendererHandle.getRenderCount()/getMapRenderCountfor deterministice2e assertions.
Verification
responsive, drag stops instantly. Firefox unchanged (smooth).
(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-checkclean; Vitest 707/707.map-togglese2e specs (idle map does not repaint; released drag doesnot coast) green on all four Playwright projects incl. WebKit.
Docs
ui/docs/renderer.md: render-on-demand section; fog section corrected to thecurrent single-
fogLayermodel; FPS note.ui/PLAN.md: Phase 29 decision 8.🤖 Generated with Claude Code
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>