From b3d9e125b1538f7642b70eb1014afe89208dc419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sun, 5 Jun 2016 00:45:11 -0700 Subject: [PATCH] [ios] Avoid adding icon when relocating annotation Fixed an issue that caused a default annotation icon to appear beneath an annotation view when relocating the annotation. --- platform/ios/src/MGLMapView.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index b05c5e41d..74e2f1e73 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1779,8 +1779,16 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) if (annotation == [self annotationWithTag:annotationTag]) { const mbgl::Point point = MGLPointFromLocationCoordinate2D(annotation.coordinate); - MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag]; - _mbglMap->updateAnnotation(annotationTag, mbgl::SymbolAnnotation { point, annotationImage.styleIconIdentifier.UTF8String ?: "" }); + + MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); + NSString *symbolName; + if (!annotationContext.annotationView) + { + MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag]; + symbolName = annotationImage.styleIconIdentifier; + } + + _mbglMap->updateAnnotation(annotationTag, mbgl::SymbolAnnotation { point, symbolName.UTF8String ?: "" }); if (annotationTag == _selectedAnnotationTag) { [self deselectAnnotation:annotation animated:YES];