Skip to content

feat(ui): zoom an enlarged picture on its own, closing it only on purpose - #510

Merged
ixuz merged 1 commit into
mainfrom
pinch-zoom
Nov 2, 2026
Merged

ixuz merged 1 commit into
mainfrom
pinch-zoom

Conversation

@ixuz

@ixuz ixuz commented Nov 2, 2026

Copy link
Copy Markdown
Member

What and why

An enlarged card picture had no zoom of its own. A pinch zoomed the whole page, and the picture often closed in the middle of it. Moving around the zoomed page counted as a scroll, which closed it, and the end of a pinch could count as a tap on the dimmed layer. Someone who pinched back out to see the whole picture found it back in the card instead.

The enlarged picture now takes every touch on its layer and zooms by itself:

  • Pinch zooms around the fingers, up to four times the fitted size. Pinching out past the fitted size springs back to it and never closes the picture.
  • Double tap zooms in on the spot tapped (2.5×). Another double tap goes back to the fitted size.
  • Drag moves the picture while zoomed in. It settles where it covers as much of the screen as it can.
  • Close with a single tap, Escape, or a throw up or down that goes far enough (15% of the screen height) or fast enough. A pinch or a drag never closes it. Focus leaving the picture and a resize still close it, as before.
  • A single tap waits 250 ms for a second one. The wait pauses while a finger is down, so a slow double tap still zooms in. The delay applies only to the enlarged picture.
  • With reduced motion, every change is instant. The stylesheet already turns off the transitions.

The gestures are covered in ZoomableImage.test.tsx, including regression tests for the gesture bugs found while building it. docs/user-guide.md and docs/data-model.md describe the new behavior.

Not yet tried on a real iOS device; the gestures are tested with simulated touch events. Zooming with the mouse wheel on desktop is left as a possible follow-up.

Closes: #508

…pose

An enlarged card picture had no zoom of its own, so a pinch zoomed the
whole page, and the picture often closed under it: moving about the
zoomed page counted as a scroll, and the end of a pinch could count as
a tap. A reader pinching back out to see the whole picture found it
back in the card instead.

The enlarged copy now takes every touch on its layer and zooms itself.
A pinch zooms it about the fingers, up to four times its fit, and a
pinch out past the fit springs back to it. A double tap zooms in on the
spot tapped and another goes back to the fit; a drag moves it while
zoomed in, settling where it covers the most of the viewport. A single
tap, Escape, or a throw up or down, far or fast enough, puts it back,
and a pinch or a drag never does. A single tap waits a moment for a
second one, held while a finger is down so a slow double tap still
zooms in. Reduced motion keeps every change instant, as the stylesheet
already stops the transitions.

Closes: #508
@ixuz ixuz added bug Something isn't working enhancement New feature or request labels Nov 2, 2026
@ixuz
ixuz enabled auto-merge November 2, 2026 14:47
@ixuz
ixuz added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit d57c98c Nov 2, 2026
51 checks passed
@ixuz
ixuz deleted the pinch-zoom branch November 2, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An enlarged card picture closes when you pinch to zoom, and can't be zoomed in on one spot

1 participant