summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-17 17:30:28 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-20 11:02:31 -0800
commit51be461168364948a7e2126626f7b9ff121a2b61 (patch)
tree81cedda8f06b5092ca311cfdb8bb7b6ec45dca0f /platform
parent41ce7b2526ec338a10a1bfcfbee0a30342b2c49a (diff)
downloadqtlocation-mapboxgl-51be461168364948a7e2126626f7b9ff121a2b61.tar.gz
[ios] Leave user location callout open when tracking
Don’t close the user location annotation’s callout when the user location changes in user tracking mode.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/src/MGLMapView.mm20
1 files changed, 17 insertions, 3 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 89e1d34503..d970eca004 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2638,7 +2638,10 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
if (annotation == self.selectedAnnotation) return;
- self.userTrackingMode = MGLUserTrackingModeNone;
+ if (annotation != self.userLocation)
+ {
+ self.userTrackingMode = MGLUserTrackingModeNone;
+ }
[self deselectAnnotation:self.selectedAnnotation animated:NO];
@@ -3032,7 +3035,12 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
self.userLocation.location = newLocation;
// deselect user if applicable since we don't do callout tracking yet
- if ([self.selectedAnnotation isEqual:self.userLocation]) [self deselectAnnotation:self.userLocation animated:NO];
+ if (self.selectedAnnotation == self.userLocation
+ && (self.userTrackingMode == MGLUserTrackingModeNone
+ || self.userTrackingState != MGLUserTrackingStateChanged))
+ {
+ [self deselectAnnotation:self.userLocation animated:NO];
+ }
if ([self.delegate respondsToSelector:@selector(mapView:didUpdateUserLocation:)])
{
@@ -3274,7 +3282,13 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
case mbgl::MapChangeRegionWillChange:
case mbgl::MapChangeRegionWillChangeAnimated:
{
- [self deselectAnnotation:self.selectedAnnotation animated:NO];
+ id <MGLAnnotation> selectedAnnotation = self.selectedAnnotation;
+ if (selectedAnnotation != self.userLocation
+ || self.userTrackingMode == MGLUserTrackingModeNone
+ || self.userTrackingState != MGLUserTrackingStateChanged)
+ {
+ [self deselectAnnotation:self.selectedAnnotation animated:NO];
+ }
if ( ! [self isSuppressingChangeDelimiters] && [self.delegate respondsToSelector:@selector(mapView:regionWillChangeAnimated:)])
{