Repository navigation
Swipe, double tap to zoom, drag away and save images in a viewer that grows out of the thumbnail - #175
Draft
simonhamp wants to merge 5 commits into
Draft
Swipe, double tap to zoom, drag away and save images in a viewer that grows out of the thumbnail#175simonhamp wants to merge 5 commits into
simonhamp wants to merge 5 commits into
Conversation
The viewer drew a band across the top just to hold the modal's close button, and moved between images with chevrons. Now the image sits on black that reaches the edges, with the app's round sheet buttons floating over it: close on the left, save on the right. Swiping sideways pages through a commit's images, with dashes at the bottom that slide to the current one. At its whole size an image can be dragged up or down: it follows the finger, the black fades, and letting go far enough (or flicking) closes the viewer. A short drag springs back. Once zoomed, a drag pans instead, until a pinch brings the image back to its whole size. Save puts the image in the phone's photo library through a small local plugin (packages/photos), since no NativePHP plugin does this. iOS asks for add-only photo access with a new usage string. Android 10 and up needs no permission. A toast says how it went. The viewer's state moved out of ShowsCommits into its own ShowsImageViewer trait, so other screens (Remotes next) can use it. Android keeps the modal's own close row for now: mobile-ui's modal only closes on Android's back while it's dismissible, and dismissible draws the row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
A double tap on an image at its whole size zooms to half the most it
zooms (twice), with the tapped point brought to the middle as far as the
picture's bounds allow. A double tap on a zoomed image goes back to its
whole size. Both animate on the phone and report through the same
@pinchEnd as a pinch, so the pans bind and let go as before.
The viewer no longer slides up. The black fades in over the screen while
the tapped picture grows out of its thumbnail into place, and closing
runs that backwards. After paging, it shrinks into the thumbnail of the
image it's showing. With no thumbnail on screen it only fades. Each
commit image now has a ref of its own (thumb-{id}) for this, beside the
pressable's, and showImagesInViewer() takes those refs.
Every page also hands its pans to the zoom as zoom-pan, which takes no
drags. That's what lets a double tap at whole size aim, and it means the
first pinch now zooms around the fingers rather than the middle.
This needs NativePHP/mobile-ui#220 and #221 and NativePHP/mobile-air#716.
Until they're in, mobile-ui ignores the new attributes: the viewer slides
up as before and a double tap does nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
mobile-air#716 renamed `double-tap-zoom` to `@doubleTap.zoom`. The pinch names stay, since they work with and without that PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With NativePHP/mobile-ui#220 and NativePHP/mobile-air#716, a bounded gesture area only takes a one-finger drag while its zoomed image has room to move, so at whole size the pager pages and the drag to close closes with the pans bound. Each page now binds its pans all the time. $viewerZoomed, viewerZoomEnded(), ImageViewer::ZoomedPast, @pinchEnd, zoom-pan and the swapped close area are gone. This needs those two PRs: without them a bound pan takes every drag, so the pager wouldn't page and the drag to close wouldn't close. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e pager With NativePHP/mobile-ui#220's latest commit, a drag past a zoomed image's edge pulls the pager on to the next image, a drag that way at the edge pages, and a drag let go glides on. The drag to close still only gets drags at whole size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks the full-screen image viewer.
sheet-bar-button, same as the composer's cross) float over it: close on the left, save on the right.packages/photos, likepackages/calls. iOS asks for add-only access with a newNSPhotoLibraryAddUsageDescription. Android 10+ needs no permission and saves to Pictures/devnull. It uses the copy in the image cache, or downloads the image first.thumb-{id}).ShowsCommitsinto a newShowsImageViewertrait. Any screen can use it by callingshowImagesInViewer($images, $index, $sources), where$sourcesare the refs of the images it was opened from, and including the partial once. Remotes is next.Things to know:
$viewerZoomed,viewerZoomEnded()and@pinchEndare gone), a pinch zooms around the fingers and a double tap aims at the tapped spot from the first.dismissibleis on, anddismissibleis what draws the row. Turning it off made back do nothing. A modal option to hide the row but keep back would fix this.Tested on an iOS 27.0 simulator and an Android 35 emulator against a local API with real photo commits: paging both ways, short and long drags, save (it landed in the simulator's Photos and the emulator's Pictures/devnull, toast shown over the viewer). Pinch, pan while zoomed and pinch back were checked on Android with injected two-finger touches. The iOS simulator tools here can't pinch, so on iOS I opened an image already zoomed to check that a drag pans it and doesn't page or close.
For the double tap and the morph I built the app with the three upstream branches swapped into
vendor(not committed): open and close from a single image and from a grid, in light and dark, closing with the button, Android's back and a drag; page then close (it shrinks into the third thumbnail); double tap in, pan without paging, double tap out, then page and drag to close. On Android the double taps and pinches were real injected touches. On iOS I couldn't make a real double tap on the simulator: AXe takes over a second per tap here and SimDeck taps don't land. So on iOS the zoom was checked by firing it from a single tap in a local build, and the double tap recognizer itself (SwiftUI's own count-2 tap, as core's@doubleTapuses) still wants a try on a phone.After the drag rule moved into the renderers I tested again, with this branch, mobile-ui#220 and mobile-air#716 in
vendor, on an iOS 27.0 simulator and an Android 35 emulator against the local API. Real double taps and two-finger pinches on both platforms this time (the iOS Simulator tool's two-finger paths, and injected MotionEvents on Android). Checked: paging and drag to close at whole size, panning without paging or closing when zoomed, a pinch ending at 1.007x still pages, double tap in and out, a swipe or drag during the double tap's zoom-out pages or closes while the zoom finishes, a pinch after a double tap, a second finger landing while paging, and back at whole size after paging away or reopening.php artisan test: 1907 passed.Screenshots
doubletap
Recordings: Android light, after, iOS light, after (zoom fired by a single tap, see Testing)
morph
Recordings: Android dark, after, Android dark, before, Android light, after, Android light, before, iOS dark, after, iOS dark, before, iOS light, after, iOS light, before
pagedclose
Recordings: Android light, after
viewer
Recordings: Android dark, after, iOS light, after
🤖 Generated with Claude Code