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

Commit

Permalink
[ios] position callout view for sprite backed annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
frederoni committed Oct 20, 2016
1 parent 7a6733c commit 232817a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4618,6 +4618,22 @@ - (void)updateAnnotationViews
else
{
// if there is no annotationView at this point then we are dealing with a sprite backed annotation
UIView <MGLCalloutView> *calloutView = self.calloutViewForSelectedAnnotation;
if (calloutView && calloutView.representedObject == annotationContext.annotation) {
NSObject<MGLAnnotation> *annotation = annotationContext.annotation;
BOOL implementsImageForAnnotation = [self.delegate respondsToSelector:@selector(mapView:imageForAnnotation:)];
if (implementsImageForAnnotation) {
MGLAnnotationImage *image = [self.delegate mapView:self imageForAnnotation:annotation];
if (!image) {
image = [self dequeueReusableAnnotationImageWithIdentifier:MGLDefaultStyleMarkerSymbolName];
}
if (image) {
CGPoint point = [self convertCoordinate:annotation.coordinate toPointToView:self];
point.y -= image.image.size.height/2.0f;
calloutView.center = point;
}
}
}
continue;
}
}
Expand Down

0 comments on commit 232817a

Please sign in to comment.