summaryrefslogtreecommitdiff
path: root/platform/osx/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx/src/MGLMapView.mm')
-rw-r--r--platform/osx/src/MGLMapView.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 9e95ef6660..a6afa0bf28 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -865,6 +865,12 @@ public:
_mbglMap->setZoom(zoomLevel, MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
}
+- (void)zoomBy:(double)zoomDelta animated:(BOOL)animated {
+ [self willChangeValueForKey:@"zoomLevel"];
+ _mbglMap->setZoom(self.zoomLevel + zoomDelta, MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
+ [self didChangeValueForKey:@"zoomLevel"];
+}
+
- (void)scaleBy:(double)scaleFactor atPoint:(NSPoint)point animated:(BOOL)animated {
[self willChangeValueForKey:@"zoomLevel"];
mbgl::PrecisionPoint center(point.x, point.y);
@@ -1299,13 +1305,13 @@ public:
- (IBAction)moveToBeginningOfParagraph:(__unused id)sender {
if (self.zoomEnabled) {
- [self scaleBy:2 atPoint:NSZeroPoint animated:YES];
+ [self zoomBy:1 animated:YES];
}
}
- (IBAction)moveToEndOfParagraph:(__unused id)sender {
if (self.zoomEnabled) {
- [self scaleBy:0.5 atPoint:NSZeroPoint animated:YES];
+ [self zoomBy:-1 animated:YES];
}
}