diff options
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index d6f4c1e7fa..a4c9f5194c 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -5012,8 +5012,10 @@ public: // If the map is pitched consider the viewport to be exactly the same as the bounds. // Otherwise, add a small buffer. - CGFloat widthAdjustment = self.camera.pitch > 0.0 ? 0.0 : -_largestAnnotationViewSize.width * 2.0; - CGFloat heightAdjustment = self.camera.pitch > 0.0 ? 0.0 : -_largestAnnotationViewSize.height * 2.0; + CGFloat largestWidth = MAX(_largestAnnotationViewSize.width, CGRectGetWidth(self.frame)); + CGFloat largestHeight = MAX(_largestAnnotationViewSize.height, CGRectGetHeight(self.frame)); + CGFloat widthAdjustment = self.camera.pitch > 0.0 ? 0.0 : -largestWidth * 2.0; + CGFloat heightAdjustment = self.camera.pitch > 0.0 ? 0.0 : -largestHeight * 2.0; CGRect viewPort = CGRectInset(self.bounds, widthAdjustment, heightAdjustment); NSArray *visibleAnnotations = [self visibleAnnotationsInRect:viewPort]; @@ -5092,13 +5094,9 @@ public: if (annotationView.layer.animationKeys.count > 0) { continue; } + // Move the annotation view far out of view to the left CGRect adjustedFrame = annotationView.frame; - if (annotationView.layer.presentationLayer) { - adjustedFrame.origin.x = -CGRectGetWidth(annotationView.layer.presentationLayer.frame) * 10.0; - } else { - // views that are added off screen do not have a presentationLayer - adjustedFrame.origin.x = -CGRectGetWidth(adjustedFrame) * 10.0; - } + adjustedFrame.origin.x = -CGRectGetWidth(self.frame) * 10.0; annotationView.frame = adjustedFrame; [self enqueueAnnotationViewForAnnotationContext:annotationContext]; } |