summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-15 12:01:37 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-18 16:54:58 -0800
commitbf87eaa7b8aa049358559a96f290603e13ac736b (patch)
treec28e725d66d6cee549b72f5f3bb13fbd1f61c6ad /platform
parentc86646519a4887d47003d11061a6a82e7ff4241c (diff)
downloadqtlocation-mapboxgl-bf87eaa7b8aa049358559a96f290603e13ac736b.tar.gz
[core, osx] Added optional padding to convenience methods
Methods that offer a convenient way to jump or ease now accept an optional padding parameter. MGLMapView specifies the padding to ensure that keyboard-based zooming and rotation respects the toolbar.
Diffstat (limited to 'platform')
-rw-r--r--platform/osx/src/MGLMapView.mm19
1 files changed, 10 insertions, 9 deletions
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index be52ed84a9..954717e5c4 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -880,13 +880,15 @@ public:
}
- (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated {
- _mbglMap->setZoom(zoomLevel, MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
+ [self willChangeValueForKey:@"zoomLevel"];
+ _mbglMap->setZoom(zoomLevel,
+ MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets),
+ MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
+ [self didChangeValueForKey:@"zoomLevel"];
}
- (void)zoomBy:(double)zoomDelta animated:(BOOL)animated {
- [self willChangeValueForKey:@"zoomLevel"];
- _mbglMap->setZoom(self.zoomLevel + zoomDelta, MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
- [self didChangeValueForKey:@"zoomLevel"];
+ [self setZoomLevel:self.zoomLevel + zoomDelta animated:animated];
}
- (void)scaleBy:(double)scaleFactor atPoint:(NSPoint)point animated:(BOOL)animated {
@@ -936,15 +938,14 @@ public:
- (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated {
[self willChangeValueForKey:@"direction"];
- _mbglMap->setBearing(direction, MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
+ _mbglMap->setBearing(direction,
+ MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets),
+ MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
[self didChangeValueForKey:@"direction"];
}
- (void)offsetDirectionBy:(CLLocationDegrees)delta animated:(BOOL)animated {
- [self willChangeValueForKey:@"direction"];
- _mbglMap->cancelTransitions();
- _mbglMap->setBearing(_mbglMap->getBearing() + delta, MGLDurationInSeconds(animated ? MGLAnimationDuration : 0));
- [self didChangeValueForKey:@"direction"];
+ [self setDirection:_mbglMap->getBearing() + delta animated:animated];
}
+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCamera {