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

[ios] Fix dequeue view variable scope #7423

Merged
merged 2 commits into from
Dec 14, 2016

Conversation

boundsj
Copy link
Contributor

@boundsj boundsj commented Dec 14, 2016

@boundsj boundsj added annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS labels Dec 14, 2016
@boundsj boundsj added this to the ios-v3.4.0 milestone Dec 14, 2016
@boundsj boundsj self-assigned this Dec 14, 2016
@boundsj boundsj requested review from frederoni and 1ec5 December 14, 2016 04:25
@mention-bot
Copy link

@boundsj, thanks for your PR! By analyzing this pull request, we identified @1ec5, @incanus and @friedbunny to be potential reviewers.

@@ -4799,7 +4799,7 @@ - (void)updateAnnotationViews
(coordinate.longitude < upperLeftCoordinate.longitude || coordinate.longitude > lowerRightCoordinate.longitude))
{
CGRect adjustedFrame = annotationView.frame;
adjustedFrame.origin.x = -CGRectGetWidth(adjustedFrame) * 2.0;
adjustedFrame.origin.x = -CGRectGetWidth(adjustedFrame) * 10.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated but taking this opportunity to increase the size of this buffer.

@boundsj boundsj force-pushed the boundsj-fix-view-reuse-scope branch from d63f084 to 258cc43 Compare December 14, 2016 05:21
toCoordinateFromView:self];
CLLocationCoordinate2D northeastCoordinate = [self convertPoint:{viewWidth + largestWidth, -largestHeight}
toCoordinateFromView:self];
MGLCoordinateBounds coordinateBounds = {southwestCoordinate, northeastCoordinate};
Copy link
Contributor

Choose a reason for hiding this comment

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

This code could use UIEdgeInsetsInsetRect() to apply a slop area around the map view’s bounds, then convert it using -convertRect:toCoordinateBoundsFromView:.

}
else
{
annotationView.center = [self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self];
CGRect adjustedFrame = annotationView.frame;
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.

Can you explain this formula?

Copy link
Contributor

Choose a reason for hiding this comment

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

If the concern is that a view might have a layer that overshoots the official bounds of the view and would thus peek out from the top edge of the map view, you could perhaps move the view so that its layer.presentationLayer.frame lies outside the map view.

@boundsj
Copy link
Contributor Author

boundsj commented Dec 14, 2016

Thanks @1ec5

@boundsj boundsj merged commit afd14cb into release-ios-v3.4.0 Dec 14, 2016
@boundsj boundsj deleted the boundsj-fix-view-reuse-scope branch December 14, 2016 18:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants