File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -768,6 +768,15 @@ MLN_EXPORT
768768 */
769769@property (nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;
770770
771+ /* *
772+ A boolean value that reverses the direction of the quick zoom gesture.
773+
774+ When this property is set, the zoom-in and zoom-out behavior during the quick
775+ zoom gesture (also called one-finger zoom) is reversed, aligning with the
776+ behavior in Apple Maps. The default value is `NO`.
777+ */
778+ @property (nonatomic , getter =isQuickZoomReversed) BOOL quickZoomReversed;
779+
771780/* *
772781 A Boolean value that determines whether the user may scroll around the map,
773782 changing the center coordinate.
Original file line number Diff line number Diff line change @@ -861,6 +861,7 @@ - (void)commonInitWithOptions:(MLNMapOptions*)mlnMapoptions
861861 _pinch.delegate = self;
862862 [self addGestureRecognizer: _pinch];
863863 _zoomEnabled = YES ;
864+ _quickZoomReversed = NO ;
864865
865866#if TARGET_IPHONE_SIMULATOR & (TARGET_CPU_X86 | TARGET_CPU_X86_64)
866867 if (isM1Simulator) {
@@ -2667,6 +2668,8 @@ - (void)handleQuickZoomGesture:(UILongPressGestureRecognizer *)quickZoom
26672668 {
26682669 CGFloat distance = [quickZoom locationInView: quickZoom.view].y - self.quickZoomStart ;
26692670
2671+ if (self.isQuickZoomReversed ) distance = - distance;
2672+
26702673 CGFloat newZoom = MAX (log2f (self.scale ) + (distance / 75 ), *self.mbglMap .getBounds ().minZoom );
26712674
26722675 if ([self zoomLevel ] == newZoom) return ;
@@ -3183,6 +3186,12 @@ - (void)setZoomEnabled:(BOOL)zoomEnabled
31833186 self.twoFingerTap .enabled = zoomEnabled;
31843187}
31853188
3189+ - (void )setQuickZoomReversed:(BOOL )quickZoomReversed
3190+ {
3191+ MLNLogDebug (@" Setting quickZoomReversed: %@ " , MLNStringFromBOOL (quickZoomReversed));
3192+ _quickZoomReversed = quickZoomReversed;
3193+ }
3194+
31863195- (void )setScrollEnabled:(BOOL )scrollEnabled
31873196{
31883197 MLNLogDebug (@" Setting scrollEnabled: %@ " , MLNStringFromBOOL (scrollEnabled));
You can’t perform that action at this time.
0 commit comments