From dd565b701b20cac69f7a84a02e7bc8a783c92bb6 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Thu, 9 Jun 2016 20:05:15 -0400 Subject: [ios] Support for a customizable zoom gesture centering strategy. (#5302) * [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 b915f05a069d4658cc11d91a4bae2ef52c5fcbf1. --- platform/ios/src/MGLMapView.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'platform/ios/src/MGLMapView.h') diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 63d799bda9..09142c4093 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -762,6 +762,25 @@ IB_DESIGNABLE */ - (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; +/** + Returns the point in this view's coordinate system on which to "anchor" in + response to a user-initiated gesture. + + For example, a pinch-to-zoom gesture would anchor the map at the midpoint of + the pinch. + + If the `userTrackingMode` property is not `MGLUserTrackingModeNone`, the + user annotation is used as the anchor point. + + Subclasses may override this method to provide specialized behavior - for + example, anchoring on the map's center point to provide a "locked" zooming + mode. + + @param gesture An anchorable user gesture. + @return The point on which to anchor in response to the gesture. + */ +- (CGPoint)anchorPointForGesture:(UIGestureRecognizer *)gesture; + /** The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. -- cgit v1.2.1