summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-26 22:59:27 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-26 22:59:27 -0800
commita5283b57987791795d6c634f6f6f826507f37f47 (patch)
treed25a221213e152d40789a21fb99290c471843088
parent8a23bdcd0194ec86857ff4dd1201b98dfe49bb48 (diff)
downloadqtlocation-mapboxgl-a5283b57987791795d6c634f6f6f826507f37f47.tar.gz
[ios] Update location after clearing target coordinate
-rw-r--r--platform/ios/src/MGLMapView.mm20
1 files changed, 12 insertions, 8 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 1952597a4c..e301686419 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -3127,11 +3127,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|| targetCoordinate.longitude != self.targetCoordinate.longitude)
{
_targetCoordinate = targetCoordinate;
- if (CLLocationCoordinate2DIsValid(targetCoordinate)
- && self.userTrackingMode == MGLUserTrackingModeFollowWithCourse
- && self.userLocation.location)
+ if (self.userTrackingMode == MGLUserTrackingModeFollowWithCourse)
{
- [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location] animated:animated];
+ self.userTrackingState = MGLUserTrackingStatePossible;
+ if (self.userLocation.location)
+ {
+ [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location] animated:animated];
+ }
}
}
}
@@ -3191,11 +3193,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
}
if (self.userTrackingMode == MGLUserTrackingModeFollowWithCourse
- && self.userTrackingState != MGLUserTrackingStateBegan
&& CLLocationCoordinate2DIsValid(self.targetCoordinate))
{
- // Keep both the user and the destination in view.
- [self didUpdateLocationWithTargetAnimated:animated];
+ if (self.userTrackingState != MGLUserTrackingStateBegan)
+ {
+ // Keep both the user and the destination in view.
+ [self didUpdateLocationWithTargetAnimated:animated];
+ }
}
else if (self.userTrackingState == MGLUserTrackingStatePossible)
{
@@ -3260,7 +3264,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
BOOL firstUpdate = self.userTrackingState == MGLUserTrackingStatePossible;
void (^completion)(void);
- if (firstUpdate)
+ if (animated && firstUpdate)
{
self.userTrackingState = MGLUserTrackingStateBegan;
__weak MGLMapView *weakSelf = self;