Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Only use non nil presentationLayers to adjust annotation views #7626

Merged
merged 1 commit into from
Jan 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4797,7 +4797,12 @@ - (void)updateAnnotationViews
else
{
CGRect adjustedFrame = annotationView.frame;
adjustedFrame.origin.x = CGRectGetWidth(annotationView.layer.presentationLayer.frame) * -2.0;
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, an off-screen view may not have a presentation layer, but it still has a layer.

}
annotationView.frame = adjustedFrame;
[self enqueueAnnotationViewForAnnotationContext:annotationContext];
}
Expand Down