Repository navigation
Conversation
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.
When a pinch ends with one finger lifted slightly before the other (common in normal use), the pan gesture continues with the remaining finger, which is intended (
testTwoToOneNumberOfTouchesTransitionIsSmooth). But if that finger is still moving when it lifts, the pan ends with deceleration, so the map flings toward the last finger.This change records when a multi-touch pan loses a touch and skips deceleration if the pan ends within 0.3 s of that. Continuing to pan with the remaining finger is unchanged, and so is deceleration for one-finger pans and for a pan that carried on with one finger before being released. No public API changes.
Android doesn't show this: there the fling comes from the platform fling detector, which discards the velocity when the lifting pointer was moving against the other (as in a pinch), and short flings after other gestures are ignored.
The same slide happens in Mapbox's own Studio Preview app on iOS, so it isn't specific to our integration. Showed in sample video below.
Measured on an iPhone 15 Pro (iOS 26.5.2): at the end of 14 pinches, the second finger lifted 0–33 ms after the first while the pan was moving at 13–372 pt/s, so each one decelerated. Deliberate one-finger flings in the same session were 585–4,141 pt/s. With this change applied to 11.32.0 in our app, pinches end without sliding, panning on with one finger still works, and one-finger flings are unchanged.
Two finger pinch reliase flick issue on Mapbox App:
https://youtube.com/shorts/mrx2qiOdGAc?feature=share
You can see the issue at the end of almost every zoom two finger gesture. If you don't release exactly at the same time you get a slight pan event that likely wasn't intended by the user.
Two finger pinch release and flick fixed:
https://youtube.com/shorts/ow4ZupCnZQI?feature=share
You will see at the end of the two finger pinch gesture, the app no longer has that slight fling event after the release of the second finger.
Pull request checklist:
PanGestureHandlerTests.testPanEndingRightAfterAFingerLiftsFromMultiTouchDoesNotDecelerate(fails without the change)PanGestureHandlerTests.testPanContinuedWithOneFingerAfterMultiTouchStillDeceleratesPanGestureHandlerTests(30/30),PinchGestureHandlerTests(17/17),GestureManagerTests(29/29) andInterruptDecelerationGestureHandlerTests(3/3) through the Swift package on an iOS 27 simulator. SwiftLint is clean on the changed files.## mainheading near the top).v10.[version]release branch fix / enhancement, merge it tomainfirst and then port tov10.[version]release branch. (not applicable)PRs must be submitted under the terms of our Contributor License Agreement CLA.