From 2bbd6ef18daaf78a3540cd3656018c8db7c51b61 Mon Sep 17 00:00:00 2001 From: Dave Prukop Date: Thu, 20 Sep 2018 15:13:03 -0700 Subject: New setCamera: edgePadding: animated: method --- platform/ios/src/MGLMapView.h | 13 +++++++++++++ platform/ios/src/MGLMapView.mm | 5 +++++ platform/macos/src/MGLMapView.h | 13 +++++++++++++ platform/macos/src/MGLMapView.mm | 5 +++++ 4 files changed, 36 insertions(+) diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 02d146edcb..db638d4aad 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -863,6 +863,19 @@ MGL_EXPORT IB_DESIGNABLE */ - (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated; +/** + Moves the viewpoint to a different location with respect to the map with an + optional transition animation. + + @param camera The new viewpoint. + @param edgePadding The minimum padding (in screen points) that would be visible. + @param animated Specify `YES` if you want the map view to animate the change to + the new viewpoint or `NO` if you want the map to display the new viewpoint + immediately. + + */ +- (void)setCamera:(MGLMapCamera *)camera edgePadding:(UIEdgeInsets)edgePadding animated:(BOOL)animated; + /** Moves the viewpoint to a different location with respect to the map with an optional transition duration and timing function. diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 92d3724b03..9a33c345dd 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3293,6 +3293,11 @@ public: [self setCamera:camera animated:NO]; } +- (void)setCamera:(MGLMapCamera *)camera edgePadding:(UIEdgeInsets)edgePadding animated:(BOOL)animated +{ + [self setCamera:camera withDuration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil edgePadding:edgePadding completionHandler:nil]; +} + - (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated { [self setCamera:camera withDuration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil]; diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h index ddb5747109..37e976e8c1 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -308,6 +308,19 @@ MGL_EXPORT IB_DESIGNABLE */ - (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated; +/** + Moves the viewpoint to a different location with respect to the map with an + optional transition animation. + + @param camera The new viewpoint. + @param edgePadding The minimum padding (in screen points) that would be visible. + @param animated Specify `YES` if you want the map view to animate the change to + the new viewpoint or `NO` if you want the map to display the new viewpoint + immediately. + + */ +- (void)setCamera:(MGLMapCamera *)camera edgePadding:(NSEdgeInsets)edgePadding animated:(BOOL)animated; + /** Moves the viewpoint to a different location with respect to the map with an optional transition duration and timing function. diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 92ba89f72d..215e1a6345 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -1120,6 +1120,11 @@ public: [self setCamera:camera animated:NO]; } +- (void)setCamera:(MGLMapCamera *)camera edgePadding:(NSEdgeInsets)edgePadding animated:(BOOL)animated +{ + [self setCamera:camera withDuration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil edgePadding:edgePadding completionHandler:nil]; +} + - (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated { [self setCamera:camera withDuration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil completionHandler:NULL]; } -- cgit v1.2.1