From 22cc375da0e2f950ae0de805b5e2b9ab01c15708 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Mon, 29 Aug 2016 16:20:29 -0700 Subject: [PATCH] [ios] Avoid updating sprite backed annotations in view update method (#6199) Previously, annotations backed by sprite had their frames updated by the view backed annotation update method. This guards against that by aborting an update for an annotation if an associated view cannot be found. In addition, some dead code is removed. --- platform/ios/src/MGLMapView.mm | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index f43029d0b..8a5b59711 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3189,25 +3189,6 @@ public: return reusableView; } -- (MGLAnnotationView *)annotationViewAtPoint:(CGPoint)point -{ - std::vector annotationTags = [self annotationTagsInRect:self.bounds]; - - for(auto const& annotationTag: annotationTags) - { - auto &annotationContext = _annotationContextsByAnnotationTag[annotationTag]; - MGLAnnotationView *annotationView = annotationContext.annotationView; - CGPoint convertedPoint = [self convertPoint:point toView:annotationView]; - - if ([annotationView pointInside:convertedPoint withEvent:nil]) - { - return annotationView; - } - } - - return nil; -} - /** Returns the tag of the annotation at the given point in the view. @@ -4586,16 +4567,15 @@ public: MGLAnnotationView *annotationView = [self annotationViewForAnnotation:annotationContext.annotation]; if (annotationView) { - // If the annotation view has no superview it means it was never used before so add it - if (!annotationView.superview) - { - [self.glView addSubview:annotationView]; - } - annotationView.mapView = self; annotationView.center = [self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self]; annotationContext.annotationView = annotationView; } + else + { + // if there is no annotationView at this point then we are dealing with a sprite backed annotation + continue; + } } bool annotationViewIsVisible = CGRectContainsRect(viewPort, annotationView.frame);