powergrid/viewer/tests
goldjohn6 a8a7718b50
Map zoom (#176)
* Zoom the map: buttons, pinch, wheel, and drag to pan

Players asked for a way to zoom in after the board is fitted to the
screen. This adds a zoom on the map alone, on top of the fitted layout,
in both the desktop and portrait layouts.

- + / − / reset buttons in the map's top-right corner, sized in screen
  pixels so they stay thumb-sized on a phone.
- Two-finger pinch on touch screens zooms the map, not the page. One
  finger pans once zoomed; at the fitted size it still scrolls the page.
- Trackpad pinch (ctrl+wheel) everywhere; a plain wheel also zooms on
  desktop, where the board fits the window.
- Mouse drag pans when zoomed. A press that moves more than 6 px is a
  pan, and the click that follows it is swallowed, so a drag never
  builds a city.
- Clamped between the fit and 4x, and the zoomed map always covers its
  own box. It is clipped to that box, so it never covers the market or
  player boards.

The zoom layer sits outside the measured map slot, so the layout's
getBBox() measurement never sees it. The maths is in util/map-zoom.ts
with unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Map zoom: a faint outline and a minimap while zoomed

Asked for with older players in mind, so a zoomed map never leaves
anyone lost. Nothing changes at the fitted size. While zoomed:

- a faint white outline round the map's box, so it reads as a zoomed view;
- a small overview of the whole map in the bottom-left corner (the
  buttons are top-right), rounded, with an orange box over the part on
  screen. Tapping the overview centres the view there.

The overview is a <use> of the map slot, so it always matches the board.
It is sized in screen pixels, from 72 to 128 px on its long side, and
keeps the map's own proportions in both the desktop and portrait
layouts. Gestures never start on the overview or the buttons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Map zoom: a plain wheel scrolls the page, Ctrl+wheel zooms

Someone scrolling down to the resources or the chat must never zoom by
accident, so a plain wheel over the map always scrolls the page. It also
shows a brief hint, "Hold Ctrl and scroll to zoom" (⌘ on a Mac), the way
embedded maps do. Ctrl/⌘ + wheel and trackpad pinch zoom the map, and
the + / − tooltips mention both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 15:02:26 -08:00
..
fixtures Integrate AI research and harden analysis autoplay 2026-10-04 11:38:12 +02:00
tutorial Add playable Powergrid tutorials and city income reference (#155) 2026-09-16 10:10:47 -07:00
unit Map zoom (#176) 2026-11-21 15:02:26 -08:00