diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-12-23 10:18:11 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-12-24 16:24:45 -0800 |
commit | 225eda4fff542918580c838f1cafa301ca7ea6fb (patch) | |
tree | 1618ac1e11ea58e479ad2c88745d4b35ef3ec204 /platform/osx | |
parent | 07cf1824d0539a3dde2f99625af231f84bf838b6 (diff) | |
download | qtlocation-mapboxgl-225eda4fff542918580c838f1cafa301ca7ea6fb.tar.gz |
[osx] Simplified zoom logic
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/src/MGLMapView.mm | 10 |
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]; } } |