diff --git a/platform/ios/src/MLNMapView.h b/platform/ios/src/MLNMapView.h index 05107dac0..d380ee80e 100644 --- a/platform/ios/src/MLNMapView.h +++ b/platform/ios/src/MLNMapView.h @@ -768,6 +768,15 @@ MLN_EXPORT */ @property (nonatomic, getter=isZoomEnabled) BOOL zoomEnabled; +/** + A boolean value that reverses the direction of the quick zoom gesture. + + When this property is set, the zoom-in and zoom-out behavior during the quick + zoom gesture (also called one-finger zoom) is reversed, aligning with the + behavior in Apple Maps. The default value is `NO`. + */ +@property (nonatomic, getter=isQuickZoomReversed) BOOL quickZoomReversed; + /** A Boolean value that determines whether the user may scroll around the map, changing the center coordinate. diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index 16acd1925..1337f0c6b 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -861,6 +861,7 @@ public: _pinch.delegate = self; [self addGestureRecognizer:_pinch]; _zoomEnabled = YES; + _quickZoomReversed = NO; #if TARGET_IPHONE_SIMULATOR & (TARGET_CPU_X86 | TARGET_CPU_X86_64) if (isM1Simulator) { @@ -2667,6 +2668,8 @@ public: { CGFloat distance = [quickZoom locationInView:quickZoom.view].y - self.quickZoomStart; + if (self.isQuickZoomReversed) distance = - distance; + CGFloat newZoom = MAX(log2f(self.scale) + (distance / 75), *self.mbglMap.getBounds().minZoom); if ([self zoomLevel] == newZoom) return; @@ -3183,6 +3186,12 @@ static void *windowScreenContext = &windowScreenContext; self.twoFingerTap.enabled = zoomEnabled; } +- (void)setQuickZoomReversed:(BOOL)quickZoomReversed +{ + MLNLogDebug(@"Setting quickZoomReversed: %@", MLNStringFromBOOL(quickZoomReversed)); + _quickZoomReversed = quickZoomReversed; +} + - (void)setScrollEnabled:(BOOL)scrollEnabled { MLNLogDebug(@"Setting scrollEnabled: %@", MLNStringFromBOOL(scrollEnabled));