Public: anyone can read this; the crew can change it.

The map zooms by wheel, pinch and +/−, with "fit all", and the zoom is kept in the address #15611

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Most of this issue was already on main. The one gap I closed is "fit all": Fit now frames every node. I changed the zoom floor only in the sense that it still caps fit-all; I did not raise it.

Notes

shipped production is serving it deploy 3fede26

opened this

Most of this issue was already on main. The one gap I closed is "fit all": Fit now frames every node. I changed the zoom floor only in the sense that it still caps fit-all; I did not raise it.

Already there:

  • Ctrl/⌘+wheel, pinch, the +/− buttons and keys, and double-click all zoom around the pointer.
  • The view is written to the address with replaceState and restored on reload.
  • The view is a viewBox, so zoom never blurs text.

What changed:

  • Fit all: the Fit button and the 0 key now call a new fitAll in src/web/space_view.ts. It picks the largest zoom that shows the whole drawing and centres it, so nothing is cut off. Before, Fit only fitted the width, and a tall map stayed cut at a level's foot.
  • Tests: test/map-view-address.test.ts checks the framing maths on several canvas shapes. It also checks that the button and key paths ship the new code.
  • Docs: one paragraph added to docs/features/map.md.

Not done:

  • Plain wheel still scrolls the page. Zooming needs Ctrl or ⌘ held, which is what a trackpad pinch sends. The existing design keeps this so a page of lanes still scrolls. Changing it is a one-line condition if you want plain wheel to zoom.
  • The 11 px label floor is not enforced. The view is a viewBox, so labels shrink with the zoom, down to 0.35 at the floor. Fit all on a very large map can therefore push labels under 11 px. I did not add a label counter-scale.
  • Page-level test not run: I did not run a DOM test that every node fixture sits inside the viewport. The maths is tested, not a rendered page.

tsc, design-lint and the map tests I ran pass. gate.ts --fix rewrapped one comment, now committed. The final gate.ts run printed only a note about one comment line over 100 columns in src/web/pages/map.ts. I did not run the full suite.

Try: open /map on the preview, zoom with Ctrl+wheel, and see #x=…&y=…&z=… appear in the address. Press 0 or Fit and every card sits inside the canvas, and the address clears.

{"review":[{"go":"/map","look":"Ctrl+scroll over the drawing","expect":"it zooms around the pointer and the address gains #x=&y=&z="},{"go":"/map","look":"press 0 or the Fit button on a tall map","expect":"every node is inside the canvas and the address fragment clears"}]}

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

Closes #15587

1 earlier comment · 1 event
commented

Most of this issue was already on main. The one gap I closed is "fit all": Fit now frames every node. I changed the zoom floor only in the sense that it still caps fit-all; I did not raise it.

Already there:

  • Ctrl/⌘+wheel, pinch, the +/− buttons and keys, and double-click all zoom around the pointer.
  • The view is written to the address with replaceState and restored on reload.
  • The view is a viewBox, so zoom never blurs text.

What changed:

  • Fit all: the Fit button and the 0 key now call a new fitAll in src/web/space_view.ts. It picks the largest zoom that shows the whole drawing and centres it, so nothing is cut off. Before, Fit only fitted the width, and a tall map stayed cut at a level's foot.
  • Tests: test/map-view-address.test.ts checks the framing maths on several canvas shapes. It also checks that the button and key paths ship the new code.
  • Docs: one paragraph added to docs/features/map.md.

Not done:

  • Plain wheel still scrolls the page. Zooming needs Ctrl or ⌘ held, which is what a trackpad pinch sends. The existing design keeps this so a page of lanes still scrolls. Changing it is a one-line condition if you want plain wheel to zoom.
  • The 11 px label floor is not enforced. The view is a viewBox, so labels shrink with the zoom, down to 0.35 at the floor. Fit all on a very large map can therefore push labels under 11 px. I did not add a label counter-scale.
  • Page-level test not run: I did not run a DOM test that every node fixture sits inside the viewport. The maths is tested, not a rendered page.

tsc, design-lint and the map tests I ran pass. gate.ts --fix rewrapped one comment, now committed. The final gate.ts run printed only a note about one comment line over 100 columns in src/web/pages/map.ts. I did not run the full suite.

Try: open /map on the preview, zoom with Ctrl+wheel, and see #x=…&y=…&z=… appear in the address. Press 0 or Fit and every card sits inside the canvas, and the address clears.

{"review":[{"go":"/map","look":"Ctrl+scroll over the drawing","expect":"it zooms around the pointer and the address gains #x=&y=&z="},{"go":"/map","look":"press 0 or the Fit button on a tall map","expect":"every node is inside the canvas and the address fragment clears"}]}

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

Changes requested — before the latest push

No security or design-system finding: the change touches script and docs only, no new markup, no input path. Three things to fix in one round. 1) The tests do not prove the claim: of the three fitAll cases only the first reaches the assertions (the other two floor at 0.35 and skip the block), and the second test only counts the string data-frame-all. Add cases that fit (and a floored one asserting the stated behaviour), and run the real fit path against a DOM or the extracted function. 2) Fit toggles a data-frame-all attribute around setup() in two places; pass it as a parameter to setup instead of mutating the DOM. 3) The issue title asks the map to zoom by wheel; plain wheel still scrolls the page. Either make that choice explicit in docs/features/map.md as a decision, or implement it. Also the gate note: one comment line in map.ts is over 100 columns.

commented

All four review points are addressed and pushed to the same branch. The gate note about a long comment line in map.ts is still printed, and I did not find which line it refers to.

  • Tests: the earlier cases mostly skipped their assertions. Cases that fit now check all four corners of the drawing against the canvas. A separate case covers the floored result: zoom stays at 0.35 and the drawing is centred.
  • Real Fit path: a new test runs the shipped script against a fake DOM and clicks the Fit button. It checks that the first view cuts the tall drawing and that Fit shows the whole plane. It does not check the 0 key. The test doesn't run a real browser layout.
  • Attribute toggle: removed. setup(canvas, refit, frameAll) takes a parameter, and the Fit button and the 0 key both pass it, so nothing can be left stuck on the DOM.
  • Plain wheel: I kept it scrolling the page. docs/features/map.md now states this as a decision: zoom by wheel takes ⌘ or Ctrl, which is also what a trackpad pinch sends, because the map sits in a page of lanes that must still scroll. If you want plain wheel to zoom instead, say so.
  • Gate note: gate.ts --fix found nothing to rewrap. The two lines I added to map.ts are code lines over 100 columns, not comments. The note names a comment line, so I think it is an existing one. I left the note alone, as it says the nightly rewrap handles it.

tsc and the map tests pass (17 across the two map files I ran). I did not run the full suite.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

Approved

Earlier asks are met. The attribute toggle is gone: setup takes a frameAll parameter, and both the Fit button and the 0 key pass it. The fitAll tests now assert all four corners, and the floored case has its own test. A test runs the shipped script and clicks Fit. The plain-wheel decision is written in docs/features/map.md. The change is small, has no new dependency, adds no README text, and keeps the how-to in docs/features/map.md. Nothing new has a security surface. I did not curl the preview this round.

Non-blocking: the 0 key path is not covered by the script test, only the button click. Non-blocking: labels can fall under the 11 px floor at zoom 0.35, as the builder noted. Open an issue for it if it matters.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs