summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-17 23:01:56 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-20 11:02:31 -0800
commita93e7d7baa285ab950b216079726d1c38709e3b3 (patch)
treebd508ff0653f9b451c25dccfe5c9915310ce46de
parent35895af5d4b01b1f0f9a035359225554495f2786 (diff)
downloadqtlocation-mapboxgl-a93e7d7baa285ab950b216079726d1c38709e3b3.tar.gz
[ios] Non-animated user tracking mode changes
Calling -setUserTrackingMode:animated: with animated set to NO should jump instantaneously to the first reported location.
-rw-r--r--platform/ios/src/MGLMapView.mm17
1 files changed, 11 insertions, 6 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 38f6d2ec65..079e5a8432 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2996,7 +2996,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
if (self.userLocationAnnotationView)
{
- [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location]];
+ [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location] animated:animated];
}
break;
@@ -3013,7 +3013,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
if (self.userLocationAnnotationView)
{
- [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location]];
+ [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location] animated:animated];
}
[self updateHeadingForDeviceOrientation];
@@ -3030,7 +3030,12 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
}
}
-- (void)locationManager:(__unused CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
+- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
+{
+ [self locationManager:manager didUpdateLocations:locations animated:YES];
+}
+
+- (void)locationManager:(__unused CLLocationManager *)manager didUpdateLocations:(NSArray *)locations animated:(BOOL)animated
{
CLLocation *oldLocation = self.userLocation.location;
CLLocation *newLocation = locations.lastObject;
@@ -3080,7 +3085,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
edgePadding:insets
zoomLevel:self.zoomLevel
direction:course
- duration:1
+ duration:animated ? 1 : 0
animationTimingFunction:linearFunction
completionHandler:NULL];
}
@@ -3095,7 +3100,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
camera.heading = course;
__weak MGLMapView *weakSelf = self;
- [self _flyToCamera:camera withDuration:-1 peakAltitude:-1 completionHandler:^{
+ [self _flyToCamera:camera withDuration:animated ? -1 : 0 peakAltitude:-1 completionHandler:^{
MGLMapView *strongSelf = weakSelf;
strongSelf.userTrackingState = MGLUserTrackingStateChanged;
}];
@@ -3113,7 +3118,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
camera.altitude = newLocation.horizontalAccuracy;
__weak MGLMapView *weakSelf = self;
- [self _flyToCamera:camera withDuration:-1 peakAltitude:-1 completionHandler:^{
+ [self _flyToCamera:camera withDuration:animated ? -1 : 0 peakAltitude:-1 completionHandler:^{
MGLMapView *strongSelf = weakSelf;
strongSelf.userTrackingState = MGLUserTrackingStateChanged;
}];