[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.
This commit is contained in:
Minh Nguyễn
2016-06-05 00:45:11 -07:00
committed by Minh Nguyễn
parent 654f015639
commit b3d9e125b1

View File

@@ -1779,8 +1779,16 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
if (annotation == [self annotationWithTag:annotationTag])
{
const mbgl::Point<double> 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];