Skip to content

Image viewer: a tap beside a zoomed image closes it - #149

Merged
rdrake merged 1 commit into
evilnet:developfrom
rdrake:fix/viewer-tap-outside-zoomed
Nov 1, 2026
Merged

rdrake merged 1 commit into
evilnet:developfrom
rdrake:fix/viewer-tap-outside-zoomed

Conversation

@rdrake

@rdrake rdrake commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

On touch, a tap closed the image viewer only at the fitted size, so that a tap on a zoomed image would not throw it away. That also swallowed a tap on the backdrop beside a zoomed image, where at the fitted size the same tap closes.

 onTouchEnd
   tapped = one finger && barely moved && quick
-           && scale ≈ fitScale
+           && (scale ≈ fitScale || outsideImage(origin))   // the img's rect as drawn, zoom and pan included
   if tapped: closeViewer()

A tap on a zoomed image still does nothing; buttons and the open link keep their own taps; the mouse path is unchanged.

Evidence

  • Before: tools/scenarios/image-viewer-back.mjs --mobile with the new step: FAIL a tap beside a zoomed image closes it.
    After:
    ok  a tap on a zoomed image leaves it open
    ok  a small pinch zooms in (1 → 1.5)
    ok  the zoomed image leaves backdrop beside it ({"x":1210,"y":750})
    ok  a tap beside a zoomed image closes it
    ok  a tap on ✕ closes the image
    ok  a tap at the fitted size closes the image
    
    The desktop run passes unchanged.
  • Checked on an iPhone 16 in the iOS shell.
  • Reviewed by Codex: no correctness issues; its two nits (scale compared to the fitted scale, comment wrapping) are in.

Merge Danger

Door: two-way

Blast Radius: image viewer

Touch closing only: a tap that lands off a zoomed image now closes it.

A tap closed the viewer only at the fitted size, so that a tap on a
zoomed image would not throw it away; it caught the backdrop around a
zoomed image too, where at the fitted size the same tap closes. A tap now
closes at the fitted size anywhere, and zoomed in when it lands off the
image as drawn. image-viewer-back.mjs --mobile zooms an image a little and
taps beside it.
@rdrake
rdrake merged commit e75411c into evilnet:develop Nov 1, 2026
2 of 4 checks passed
@rdrake
rdrake deleted the fix/viewer-tap-outside-zoomed branch November 1, 2026 00:00

This branch was previously deployed

1 inactive deployment
github-pages — d0fd4b37 Deployed Nov 1, 2026 by rdrake via deploy #386
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