[ios] Non-animated user tracking mode changes

Calling -setUserTrackingMode:animated: with animated set to NO should jump instantaneously to the first reported location.
This commit is contained in:
Minh Nguyễn
2016-01-17 23:01:56 -08:00
committed by Minh Nguyễn
parent 35895af5d4
commit a93e7d7baa

View File

@@ -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;
}];