From d191b8fe23500502baffab4686b73723fc9fced1 Mon Sep 17 00:00:00 2001 From: Robert Douglas <57234112+realrobertdouglas@users.noreply.github.com> Date: Wed, 2 Dec 2026 07:15:08 -0600 Subject: [PATCH] fix(zoom): a deep zoom is sharp to the edges of the view, and first under the pointer (ZOOM-EDGES) An estimator on a trackpad: the change DEEP-ZOOM made showed with the cursor at the middle of the screen and not toward its edges. The zoom itself was right; the sharpening after it lagged. Measured on the restaurant sheet at about 3000%, Retina density: the centre was sharp 0.7 s after the zoom, a pointer at a corner 1.6 to 2.9 s, and on a 1728 x 1117 window without navigator.deviceMemory one corner never stayed sharp while the grid rastered for good. pdf-tile-cache.js: - the tile grid's cells fill outward from the pointer (ctx.getFocusPoint, state.mousePos), the view's centre when the pointer is off it - a landed cell asks for the next at once, not after the 200 ms settle - a cell on screen is never evicted; the budget bounds what is kept off screen - rebaseCropTile: where the new base is clamped soft, the commit's sharp window is kept, its box re-authored, until the grid behind it can replace all of it After: sharp everywhere about 0.3 s after the zoom on every window tried. New zoom-edges.spec.js (both tests fail on the code before). Also the docs pass since ec29abc: manage-user's set_flags verb and the roster's two new flags (#339) are written down, and ARCHITECTURE.md's pdf-tile-cache.js row no longer says the tile grid lives in app.js. Co-Authored-By: Claude Fable 5.2 --- AGENTS.md | 4 +- ARCHITECTURE.md | 123 +++++++++++------------ CHANGELOG.md | 61 ++++++++++++ app.js | 15 +-- journeys/plans/DEEP-ZOOM.md | 36 +++++++ pdf-tile-cache.js | 132 ++++++++++++++++++++----- sw.js | 6 +- zoom-edges.spec.js | 189 ++++++++++++++++++++++++++++++++++++ 8 files changed, 469 insertions(+), 97 deletions(-) create mode 100644 zoom-edges.spec.js diff --git a/AGENTS.md b/AGENTS.md index e04416e8..ef4577eb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -421,7 +421,9 @@ `profiles.is_digital_twin` required; see PipeTooling's `docs/DIGITAL_TWINS_PLAN.md`), `manage-user` (the CT↔PT user bridge — PipeTooling is the system of record for people and commands account provisioning/flagging/retirement here over - `X-Bridge-Secret` / `CT_MANAGE_USER_SECRET`; server→server only, never a browser), + `X-Bridge-Secret` / `CT_MANAGE_USER_SECRET`; server→server only, never a browser; since + 2026-11-26 its `roster` verb sends `is_overseer` and `is_lead` beside `is_admin`, and + `set_flags` sets a seat's admin, overseer and lead flags, never switching off the last admin), `import-takeoff` (the agent door for a headless takeoff: an agent POSTs a `takeoff.json` and the marks land as a normal, twin-owned project; contract in [TAKEOFF_IMPORT.md](TAKEOFF_IMPORT.md), scorer in takeoff-eval.js); diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 1d55ddee..2a81ca5d 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -17,7 +17,7 @@ Implementation history (the sync-hardening work + the modularization arc) lives ## Large-file map (decomposition status) -Current first-party line counts (`wc -l`, 2026-10-15 — the **numbers and this +Current first-party line counts (`wc -l`, 2026-12-02 — the **numbers and this date are GENERATED** by `npm run build:filemap` ([scripts/build-filemap.js](scripts/build-filemap.js)); `npm run check` fails when they drift, so don't edit counts by hand. Which files are listed and every @@ -28,9 +28,9 @@ off — and where it doesn't. | File | Lines | Status / verdict | |------|------:|------------------| -| [app.js](app.js) | 7,321 | **The remaining monolith** — down from 16.2k (9.9k after save-engine Stage 6, 8.1k after the Tier-2 splits, then −987 from the canvas-draw extraction). The only file worth actively shrinking; the region table below says what's left and in what order. | +| [app.js](app.js) | 7,322 | **The remaining monolith** — down from 16.2k (9.9k after save-engine Stage 6, 8.1k after the Tier-2 splits, then −987 from the canvas-draw extraction). The only file worth actively shrinking; the region table below says what's left and in what order. | | [save-engine.js](save-engine.js) | 3,263 | Done — the extracted save/sync seam module (Stages 1–7), 91 node tests. R21 (2026-09-26) folded its repeated blocks inside the file; do not split it. Large but modular and fully node-testable; no further action. | -| [pdf-tile-cache.js](pdf-tile-cache.js) | 867 | Done (stage 1, 2026-07-30) — the PDF raster-cache substrate extracted from app.js's "PDF render bitmap cache" section (`createPdfTileCache(ctx)`, the save-engine seam recipe): page-bitmap LRU, downsample pyramid, persisted zoom rungs, idle prefetch, full-document warm-up. Pinned by nine Playwright specs (page-switch-cache, pyramid, pyramid-persist, rung-prefetch, doc-warmup, zoom-ladder, commit-tile, crop-tile, tile-grid). Stage 2 (later): the Sharp crop tile / tile grid section. | +| [pdf-tile-cache.js](pdf-tile-cache.js) | 949 | Done (stage 1, 2026-07-30) — the PDF raster-cache substrate extracted from app.js's "PDF render bitmap cache" section (`createPdfTileCache(ctx)`, the save-engine seam recipe): page-bitmap LRU, downsample pyramid, persisted zoom rungs, idle prefetch, full-document warm-up. Pinned by nine Playwright specs (page-switch-cache, pyramid, pyramid-persist, rung-prefetch, doc-warmup, zoom-ladder, commit-tile, crop-tile, tile-grid). Stage 2 (later): the Sharp crop tile / tile grid section. | | [canvas-draw.js](canvas-draw.js) | 1,417 | Done — the unified annotation draw core (`createCanvasDraw(deps)` + `drawAnnotationsCore`), node-tested, guarded by [render-pixels.spec.js](render-pixels.spec.js). Both draw paths are thin env-builders over it. | | [app/index.html](app/index.html) | 3,882 | The shell: HTML structure + every modal, no inline JS. Flat markup with no build step to split it; grows roughly linearly with modal count. Leave. | | [styles.css](styles.css) | 2,881 | All CSS, token-organized. Leave. | @@ -86,7 +86,7 @@ modules. Candidates in priority order: | [annotation-model.js](annotation-model.js) | **The canvas/annotation data model** (Tier-2 item 7) — exports `createAnnotationModel(ctx)` + `createUndoStack(ctx)`, the same seam recipe as the save engine. Classic `