diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index dfac4db862..beb0438591 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2952,6 +2952,19 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) - (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated { + CGFloat defaultPadding = 100; + CGFloat yPadding = (self.frame.size.height / 2 <= defaultPadding) ? (self.frame.size.height / 5) : defaultPadding; + CGFloat xPadding = (self.frame.size.width / 2 <= defaultPadding) ? (self.frame.size.width / 5) : defaultPadding; + + UIEdgeInsets edgeInsets = UIEdgeInsetsMake(yPadding, xPadding, yPadding, xPadding); + + [self showAnnotations:annotations + withEdgeInsets:edgeInsets + animated:animated]; +} + +- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations withEdgeInsets:(UIEdgeInsets)edgeInsets animated:(BOOL)animated +{ if ( ! annotations || ! annotations.count) return; mbgl::LatLngBounds bounds = mbgl::LatLngBounds::getExtendable(); @@ -2968,12 +2981,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) } } - CGFloat defaultPadding = 100; - CGFloat yPadding = (self.frame.size.height / 2 <= defaultPadding) ? (self.frame.size.height / 5) : defaultPadding; - CGFloat xPadding = (self.frame.size.width / 2 <= defaultPadding) ? (self.frame.size.width / 5) : defaultPadding; - [self setVisibleCoordinateBounds:MGLCoordinateBoundsFromLatLngBounds(bounds) - edgePadding:UIEdgeInsetsMake(yPadding, xPadding, yPadding, xPadding) + edgePadding:edgeInsets animated:animated]; } |