Repository navigation
feat(Viewport): per-gesture transitionsToIdleUponUserInteraction - #4364
Merged
Merged
Conversation
transitionsToIdleUponUserInteraction now also accepts an object of gestures (pan, pinch, doubleTap, rotate, pitch), so following can stop on a pan but continue through zoom, rotate and pitch. Omitted keys default to true; the boolean form is unchanged. With the object form, the SDK option is turned off and the viewport is idled from the typed gesture-begin callbacks. While following, a zoom/rotate/pitch gesture that doesn't idle clears the follow state's zoom/bearing/pitch so the user's value sticks, and zoom gestures are anchored on the puck via the gesture focal point. Fixes #3115
mfazekas
force-pushed
the
feat/viewport-idle-per-gesture
branch
from
October 23, 2026 20:48
4acb395 to
9ed4eff
Compare
mfazekas
marked this pull request as ready for review
October 24, 2026 05:15
This branch was previously deployed
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.
Description
Fixes #3115
Viewport'stransitionsToIdleUponUserInteractionnow also accepts an object, so following can stop on a pan but keep going through zoom, rotate and pitch:Keys are
pan,pinch(also quick zoom),doubleTap(also two-finger tap zoom out),rotateandpitch. Omitted keys default totrue. The boolean form is unchanged.With the object form, native turns the SDK's own option off and calls
viewport.idle()when a gesture whose key istruebegins. The status event still reportsUserInteractionas the reason.GestureManagerDelegate.didBegin. For idling gestures it also cancels camera animations, as the SDK option does on touch.onScaleBeginwithout starting the scale detector. A scale begin is therefore classified on the next main-loop turn: pinch if the scale detector is in progress by then, otherwise double tap. WhenpinchanddoubleTaphave the same value, no classification is needed and it is handled immediately.While in a followPuck state, a zoom, rotate or pitch gesture that doesn't idle clears the live state's
zoom,bearingorpitch, so the user's value sticks. The nexttransitionToapplies the requested values again.Focal point: while following with
pinchordoubleTapnot idling, the gesture focal point is set to the puck's screen position (the padded viewport centre) and kept updated on camera changes. Pinch-pan is also turned off, which stops a drifting two-finger pinch from beginning a pan. iOS usesfocalPoint/pinchPanEnabledin points; Android usesfocalPoint/pinchScrollEnabled, wherecameraState.paddingand the view size are already in pixels. Both are restored when following ends. Neither is touched if the app already set a focal point orgestureSettings.pinchPanEnabled. If the focal point changes under us (e.g. once #4163 lands), we stop managing it, so the app's value wins.Unmounting
<Viewport>removes the gesture listeners and restores the focal point and pinch-pan. Like the boolean prop on main, it leaves the SDK option itself as last set. That is being fixed separately (the "prop stays on the map after unmount" fix). The two changes touch neighbouring code inRNMBXViewporton both platforms, so whichever lands second may need a small rebase.Camera followUserLocationis unchanged.Verified on an iOS 26.5 simulator and an Android 14 emulator, on main and then on this branch, following a simulated location moving at about 15 m/s (new example: Camera > Viewport Gestures):
true/falsebehave as on main on both platforms. Withtrue: pan idles; iOS pure pinch keeps following; Android double-tap idles. Withfalse: pan and zoom are overwritten by the follow state.{ pan: true }: a pan idles immediately and the map pans (both). iOS pinch and double-tap keep following, stay centred on the puck, and the zoom sticks (16 → 16.56 → 17.56). Android double-tap keeps following and centred and sticks at 17. Re-following restores zoom 16 (Android).{ pan: false, pinch: false, doubleTap: true }: double-tap idles and pan keeps following, which exercises the double-tap classification.Not verified:
Open questions:
Camera followUserLocationget the same option?onScaleBeginfrom its double-tap animation, which is internal behaviour of maps-android 11.x.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
iOS,
{ pan: true }and the rest kept: follow, then an off-centre pinch (zoom 16.56), still 16.56 four seconds later, then a double-tap (17.56). Still following, with the puck centred.Android, same config: double-tap (17), still 17 four seconds later, re-follow restores 16, then a pan idles with
UserInteraction.iOS: a swipe while following with
true(left) and with the object form (right). Both idle and pan the map.Component to reproduce the issue you're fixing
See
example/src/examples/Camera/ViewportGestures.tsx.