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

Commit

Permalink
[ios] keep callout view open when panning
Browse files Browse the repository at this point in the history
  • Loading branch information
frederoni committed Oct 12, 2016
1 parent 0fc7fd1 commit 7a6733c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4466,13 +4466,6 @@ - (void)notifyMapChange:(mbgl::MapChange)change
case mbgl::MapChangeRegionWillChange:
case mbgl::MapChangeRegionWillChangeAnimated:
{
if ( ! _userLocationAnnotationIsSelected
|| self.userTrackingMode == MGLUserTrackingModeNone
|| self.userTrackingState != MGLUserTrackingStateChanged)
{
[self deselectAnnotation:self.selectedAnnotation animated:NO];
}

if ( ! [self isSuppressingChangeDelimiters] && [self.delegate respondsToSelector:@selector(mapView:regionWillChangeAnimated:)])
{
BOOL animated = change == mbgl::MapChangeRegionWillChangeAnimated;
Expand Down Expand Up @@ -4637,6 +4630,15 @@ - (void)updateAnnotationViews
else
{
annotationView.center = [self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self];
UIView <MGLCalloutView> *calloutView = self.calloutViewForSelectedAnnotation;
if (calloutView && calloutView.representedObject == annotationContext.annotation) {
CGPoint point = annotationView.center;
point.y -= annotationView.bounds.size.height/2.0f;
if ( ! CGPointEqualToPoint(calloutView.center, point))
{
calloutView.center = point;
}
}
}
}

Expand Down

0 comments on commit 7a6733c

Please sign in to comment.