Skip to content

Add zoom controls to the research maps - #336

Merged
nstarman merged 3 commits into
mainfrom
research/map-zoom
Oct 6, 2026
Merged

nstarman merged 3 commits into
mainfrom
research/map-zoom

Conversation

@nstarman

@nstarman nstarman commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Changing code or schema

What and why: The two world maps on /research/ (collaborators, conferences) were fixed at world scale, where the dozens of pins around Boston, New York and Europe sit on top of each other. This adds zoom.

  • Zoom in, zoom out and "show the whole world" buttons in the map's corner; drag to pan once zoomed; Ctrl/⌘ + wheel (which is also a trackpad pinch) zooms at the cursor. A bare wheel is left alone, so the page still scrolls past.
  • src/lib/mapzoom.js moves the SVG's viewBox, keeping the aspect ratio, so the figure's height never changes and nothing below it jumps. Up to 8×.
  • Pins, trails and dashes are multiplied by --k (= 1/zoom) in map.css, so they stay the same size on screen instead of growing into blobs.
  • When zoomed, a trail is hidden unless one of its person's pins is on screen, so lines running in from elsewhere do not clutter the view; reset shows them all again.
  • Progressive enhancement, like the person picker: the buttons are hidden in the markup and shown by the script, so with JavaScript off the page is unchanged. A drag that moved is not treated as a click on the pin it ended over.
  • tests/mapzoom.test.js covers the view maths (clamping to the map, zoom about the cursor, zoom limits). Driven in a browser: zoom, pan, wheel, reset, pin sizes and clicking a pin all behave.

Not included: two-finger pinch on touch screens (the page's own pinch-zoom still works) and keyboard panning; the buttons are keyboard-reachable.

  • npm test passes
  • No link.rel or type added; no schema change

Screenshots

The collaborator map on /research/ — with JavaScript off the map is unchanged; with it on, here zoomed to the eastern US and Europe.

JavaScript off

Collaborator map with JavaScript off

JavaScript on, zoomed

Collaborator map with JavaScript on, zoomed

🤖 Generated with Claude Code

Zoom in, out and reset buttons, drag to pan once zoomed, and ctrl/pinch
wheel to zoom at the cursor, by moving the SVG's viewBox. Pins and lines
scale back by 1/zoom so they keep their size. The controls are hidden
until the script runs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nstarman nstarman added this to the ♾️&➡ milestone Oct 6, 2026
nstarman added a commit that referenced this pull request Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Preview: https://15d01c51.nstarkman-space.pages.dev

Built from b2e90525945e5e1dc332387e385db7b07bb3d883, including the four CV PDFs.
Updated on every push to this pull request.

nstarman and others added 2 commits October 6, 2026 02:45
… in calc() keeps the pins

r:calc(3 * var(--k)) is a unitless number; a browser that does not take
that for r makes the whole declaration invalid at computed-value time,
which resets r to 0 and hides every pin. calc(3px * var(--k)) is a length
everywhere.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nstarman
nstarman merged commit 5b8d327 into main Oct 6, 2026
6 of 7 checks passed
@nstarman
nstarman deleted the research/map-zoom branch October 6, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant