Repository navigation
fix(android): zoom a pinched scroll view out until the fingers meet - #2311
XiaoMengXinX wants to merge 4 commits into
Conversation
houko
left a comment
There was a problem hiding this comment.
Reviewed against the latest origin/main (8d57260). The custom spread tracking in internal/platform/android/java/dev/oneo/nsgo/Scrolling.java addresses the reported pinch-in cutoff, and the expanded ZoomScrollCheck regression passes locally.
Local verification:
- go tool nsgo check -target android ./internal/platform/android
- go tool nsgo test -run '^TestZoomScrollBrakingTouch$' ./internal/platform/android -- -count=1
I cannot approve yet because the pull request is 27 commits behind main and its current GitHub checks contain only triage checks. This branch also includes the unmerged #2301 commit as described in the PR body. Rebase onto current main after #2301 is resolved, then publish the repository check/test results.
8a0b532 to
87e5cea
Compare
|
Rebased onto current Results on the rebased commit, run locally on macOS:
As on #2301, the Check, Test, Repository quality and CodeQL workflows wait for a maintainer to approve workflow runs from a first-time contributor. |
houko
left a comment
There was a problem hiding this comment.
Source-level review against the pinch-in issue. The PR removes ScaleGestureDetector's minimum-span cutoff and computes a spread from every active pointer. Pinch activation waits for 2 * touchSlop, applies the ratio of successive spreads around the current middle, and resets both spread and anchor when a pointer lands or lifts. This covers the reported case where Android stopped zooming out near its detector threshold. The regression explicitly closes the spread below that threshold and checks that zoom returns to 1. I found no source-level defect. Approval remains blocked by the branch's stale base and incomplete current checks.
87e5cea to
4587e40
Compare
|
Rebased again onto current On that commit, locally on macOS:
|
4587e40 to
dd86c46
Compare
|
Rebased onto current On that commit, locally on macOS:
The Check, Test, Repository quality and CodeQL runs for this push still wait for a maintainer to approve workflow runs. |
dd86c46 to
7402c54
Compare
|
Rebased onto current Locally on macOS:
Check, Test, Repository quality and CodeQL for this head are still |
3907063 to
c74c1e6
Compare
|
Rebased onto current
@houko your two reviews left only one blocker: the repository checks are not current. Every push puts Check, Test, Repository quality and CodeQL in |
houko
left a comment
There was a problem hiding this comment.
Rebased onto latest main and verified locally with go tool nsgo check -target android ./internal/platform/android and go tool nsgo test ./internal/platform/android -run '^TestZoomScrollBrakingTouch$' -count=1. The spread-based pinch tracking covers pinch-in below the old detector threshold and restarts after pointer-count changes. The targeted regression passes. Approving and enabling merge after required checks.
8c08a0e to
f7d2bf3
Compare
|
Superseded by the rebased acceptance PR #2415, which passed all required checks and was merged. Closing this original branch to keep the fix represented once. |
Pull request was closed
Summary
Follows #2301, which has merged; this branch is rebased onto
mainand holds only the pinch change.On Android, a pinch on a zoomable
Scrollstopped zooming out partway.ZoomScrollread pinches throughScaleGestureDetector, which ends a pinch once the fingers' span drops below its minimum span (config_minScalingSpan, about 27mm). Pinching a zoomed picture back out therefore stalled once the fingers came that close, and the rest of the movement did nothing.ZoomScrollnow reads the pinch from the fingers' spread itself. The spread is twice the fingers' mean distance from their middle. A pinch begins once the spread has changed by more than twice the touch slop, then zooms by the ratio of the spread to its last value, around the fingers' middle. When a finger lands or lifts, both the spread and the middle restart from the fingers still down, as the pan's anchor does after #2301.noPinchZoomstill turns pinches off.Dropping the detector also drops Android's one-finger quick scale (double tap, then drag), which
ScaleGestureDetectorturns on by default.ZoomScrollonly ever got it by accident, when its content took no touches, and while it zoomed the same finger also panned the view. iOS'sUIScrollViewhas no such gesture andNsgoViewalready turns it off forOnPinch, so a zoomableScrollnow zooms with two-finger pinches only; the changelog fragment records this under Changed.Targets
core,base,ui,tsx, thensgotool)iOS zooms with
UIScrollView's own pinch and does not have this limit.NsgoView'sOnPinchelement gesture also usesScaleGestureDetectorand may stop the same way. This pull request does not change it; that is left for a follow-up.Screenshots
None. The change is in how far a pinch zooms, which a still image does not show.
Verification
Run on this branch rebased onto
mainat 9f2ee7e:go tool nsgo check -target android ./internal/platform/androidgo tool nsgo test ./internal/platform/android -- -count=1: 154 passed, 9 skipped.go tool nsgo test -target android: not run.ZoomScrollCheckgains a case that pinches with two fingers. A spread within the slop leaves the zoom at 1. Spreading the fingers from 150 to 450 zooms to 3, and closing them back to 150 returns the zoom to 1. The test stub ofScaleGestureDetectoris removed, as nothing uses it now. Against the previousScrolling.javathe case fails withspreading the fingers zoomed to 1.0. That failure shows only that the old code pinched through the detector, because the stub never scales. The 27mm cutoff comes from the platform's own detector, so the JVM test cannot reproduce it.On a Pixel 9 (Android 17), I ran an app with a runtime built from this
Scrolling.javathroughinternal/platform/android/runtime/build.sh. In a picture viewer where pinching out used to stall partway, the pinch now carries on. One-finger pans and double-tap zoom still work. I could not script a two-finger pinch on the device, so how close the fingers can come rests on the JVM test. This pull request leavesclasses.dexandclasses.jaralone, asAGENTS.mdasks.Checklist
fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.changelog.d/fragment, not inCHANGELOG.md.🤖 Claude Opus 5.5