diff options
author | Jesse Bounds <jesse@rebounds.net> | 2016-06-28 12:07:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-28 12:07:12 -0700 |
commit | 16b859ff5f0463f27d7250bf1e82fa7236304285 (patch) | |
tree | 1148b6296cd9da9be5be947e0333d4815a205772 /platform/ios/src/MGLAnnotationView.mm | |
parent | c96b7dae687f43a7ca233698554aa33eb3180f0a (diff) | |
download | qtlocation-mapboxgl-16b859ff5f0463f27d7250bf1e82fa7236304285.tar.gz |
[ios] Always set map view reference when annotation view is created. (#5496)
This fixes two issues with annotation views that were exposed when
dragging them:
1) The annotation view's mapView property was not set until it was
moved (in `updateAnnotations:`) so it did not always call its delegate
back about the map view delegate dragging methods. This adds a call to
set the property when an annotation view is created so the delegate
methods are always called.
2) Since the mapView is now always set, a call to the map view's
callout view for selected annotation was added to the annotation
view drag handler. This forces the callout to close and eliminates
an issue where the callout would remain visible as an annotation
was dragged away which had the visual effect of a detached
callout.
To make 2 possible, the map views selected callout view was exposed
in the private header.
Diffstat (limited to 'platform/ios/src/MGLAnnotationView.mm')
-rw-r--r-- | platform/ios/src/MGLAnnotationView.mm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm index e086e3bde5..7068cdc0db 100644 --- a/platform/ios/src/MGLAnnotationView.mm +++ b/platform/ios/src/MGLAnnotationView.mm @@ -187,7 +187,7 @@ { CGPoint center = [sender locationInView:sender.view.superview]; [self setCenter:center pitch:self.mapView.camera.pitch]; - + if (sender.state == UIGestureRecognizerStateEnded) { self.dragState = MGLAnnotationViewDragStateNone; } @@ -206,9 +206,10 @@ if (dragState == MGLAnnotationViewDragStateStarting) { + [self.mapView.calloutViewForSelectedAnnotation dismissCalloutAnimated:animated]; [self.superview bringSubviewToFront:self]; } - + if (dragState == MGLAnnotationViewDragStateEnding) { if ([self.mapView.delegate respondsToSelector:@selector(mapView:didDragAnnotationView:toCoordinate:)]) @@ -231,7 +232,7 @@ { return NO; } - + return YES; } |