-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] Support for a customizable zoom gesture centering strategy. #5302
Conversation
We introduce a new MGLZoomGestureCentering enum and corresponding zoomGestureCentering property on MGLMapView. Currently, Mapbox automatically adjusts the center of the map relative to the user's gesture location, but for some applications (e.g Uber, Lyft) it is preferable to keep the map center "locked" in response to zoom gestures. Exisiting code will retain its current behavior without modification and will implicitly use the default value of MGLZoomGestureCenteringFollowsTouch. New code can specify MGLZoomGestureCenteringLockedInPlace to get the new "locked" behavior.
Besides the pinch/zoom gesture, the rotation, double-tap, two-finger tap, and double-tap-drag (“quickzoom”) gestures are also anchored to the user location when user tracking mode is on. Currently, these gesture recognizers make use of the An enum for this property is clearer than a simple Boolean. However, I wonder if it’s flexible enough for the use cases you describe. For example, what if the location you want to lock around is neither the user’s location nor the center of the view? It could be the selected annotation, for example. In that case, I think we could avoid adding a |
What a fast and well-thought-out response...thank you. I agree that overriding a publicly-visible |
OK! Hopefully this is more in line with what you're thinking. |
Perfect, thanks! |
) * [ios] Support for a customizable zoom gesture centering strategy. We introduce a new MGLZoomGestureCentering enum and corresponding zoomGestureCentering property on MGLMapView. Currently, Mapbox automatically adjusts the center of the map relative to the user's gesture location, but for some applications (e.g Uber, Lyft) it is preferable to keep the map center "locked" in response to zoom gestures. Exisiting code will retain its current behavior without modification and will implicitly use the default value of MGLZoomGestureCenteringFollowsTouch. New code can specify MGLZoomGestureCenteringLockedInPlace to get the new "locked" behavior. * [ios] Added -anchorPointForGesture: to MGLMapView Cherry-picked from b915f05.
We introduce a new MGLZoomGestureCentering enum and corresponding zoomGestureCentering property on MGLMapView.
Currently, Mapbox automatically adjusts the center of the map relative to the user's gesture location, but for some applications (e.g Uber, Lyft) it is preferable to keep the map center "locked" in response to zoom gestures.
Exisiting code will retain its current behavior without modification and will implicitly use the default value of MGLZoomGestureCenteringFollowsTouch. New code can specify MGLZoomGestureCenteringLockedInPlace to get the new "locked" behavior.