Repository navigation
fix(android): keep a zoomed scroll view still as fingers land and lift - #2301
Conversation
|
Thanks for your first pull request! Before it is merged:
|
a0fbec2 to
d8cec13
Compare
houko
left a comment
There was a problem hiding this comment.
Reviewed against the latest origin/main (8d57260). The pointer-down and pointer-up anchor changes in internal/platform/android/java/dev/oneo/nsgo/Scrolling.java match the described jump, and the added 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. Please rebase onto current main and publish the repository check/test results before approval.
d8cec13 to
4d5f231
Compare
|
Rebased onto current Results on the rebased commit, run locally on macOS:
The repository's own Check, Test, Repository quality and CodeQL workflows are queued for this push but wait for a maintainer to approve workflow runs from a first-time contributor, which is why only the triage checks show. Could someone with access approve them? |
houko
left a comment
There was a problem hiding this comment.
Source-level review against #2302. In Scrolling.ZoomScroll.onInterceptTouchEvent, the ACTION_POINTER_DOWN branch resets lastX/lastY from the new two-finger middle before interception returns, which prevents the first subsequent move from applying the old one-finger anchor. In onTouchEvent, ACTION_POINTER_UP excludes getActionIndex() from the middle before storing the next anchor. The new regression then checks no offset jump on lift and verifies the following one-finger delta. I found no behavioral defect in this change. Approval remains blocked only because the branch is stale and its required checks are not current.
4d5f231 to
555e1b2
Compare
|
Rebased again onto current On that commit, locally on macOS:
|
555e1b2 to
1d775ae
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. |
1d775ae to
a12c6e6
Compare
|
Rebased onto current Locally on macOS:
Check, Test, Repository quality and CodeQL for this head are still |
2fba468 to
fc4b6de
Compare
fc4b6de to
4993e9d
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 touch-anchor change matches the second-finger landing and finger-lift paths in Scrolling.java, and the targeted regression passes. Approving and enabling merge after required checks.
Summary
A zoomable
Scrollon Android pans by the middle of the fingers while they pinch, but it took that middle from the wrong fingers when their number changed, so the content jumped by about half the fingers' spread:onInterceptTouchEventtakes the touch atACTION_POINTER_DOWN, soonTouchEventnever sees that event and the pan's anchor stays on the first finger. The next move then measures from the two fingers' middle.ACTION_POINTER_UPthe lifting finger is still in the event, so the anchor became the middle of both fingers. The next move measures from the one finger that stays.The scroll view now takes its anchor from the middle of the fingers that remain down, both when it intercepts a second finger and when one lifts.
In an app with a pinch-zoomable picture viewer, every pinch ended with the picture jumping by 100 to 200 points. The app's logs of the scroll view's offset showed the jump in a single frame, with the zoom scale unchanged and no pan events.
Targets
core,base,ui,tsx, thensgotool)iOS pans a zoomed
UIScrollViewitself and does not have this jump.Screenshots
None. The change is in how the content moves during a pinch, 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.The test stub's
MotionEventnow takes several fingers and an action index.ZoomScrollCheckgains a case that pans with two fingers, lifts one, and checks that the content stays put and then follows the remaining finger. Againstmain'sScrolling.javathe case fails withtwo fingers did not pan by their middle: -50,40; with this change it passes.I ran the app built with a runtime from this
Scrolling.javaon a Pixel 9 (Android 17), usinginternal/platform/android/runtime/build.sh. One-finger pans and the scroll view's double-tap zoom still work there. I could not script a two-finger pinch on the device, so that part 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.