Fix: follow with heading tracking mode cancels user location indicator update (#3401)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
committed by
GitHub
parent
3a3e90879c
commit
a41da826d0
@@ -4098,10 +4098,10 @@ static void *windowScreenContext = &windowScreenContext;
|
||||
self.userTrackingMode = MLNUserTrackingModeFollow;
|
||||
}
|
||||
|
||||
[self _setDirection:direction animated:animated];
|
||||
[self _setDirection:direction center:kCLLocationCoordinate2DInvalid animated:animated];
|
||||
}
|
||||
|
||||
- (void)_setDirection:(CLLocationDirection)direction animated:(BOOL)animated
|
||||
- (void)_setDirection:(CLLocationDirection)direction center:(CLLocationCoordinate2D)center animated:(BOOL)animated
|
||||
{
|
||||
if (!_mbglMap)
|
||||
{
|
||||
@@ -4123,10 +4123,26 @@ static void *windowScreenContext = &windowScreenContext;
|
||||
else
|
||||
{
|
||||
CGPoint anchor = self.userLocationAnnotationViewCenter;
|
||||
self.mbglMap.easeTo(mbgl::CameraOptions()
|
||||
.withBearing(direction)
|
||||
.withAnchor(mbgl::ScreenCoordinate { anchor.x, anchor.y }),
|
||||
MLNDurationFromTimeInterval(duration));
|
||||
|
||||
mbgl::CameraOptions cameraOptions = mbgl::CameraOptions()
|
||||
.withBearing(direction)
|
||||
.withAnchor(mbgl::ScreenCoordinate { anchor.x, anchor.y });
|
||||
|
||||
mbgl::AnimationOptions animationOptions;
|
||||
animationOptions.duration.emplace(MLNDurationFromTimeInterval(duration));
|
||||
|
||||
if (CLLocationCoordinate2DIsValid(center))
|
||||
{
|
||||
cameraOptions.center = MLNLatLngFromLocationCoordinate2D(center);
|
||||
|
||||
if (duration)
|
||||
{
|
||||
CAMediaTimingFunction *function = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animationOptions.easing.emplace(MLNUnitBezierForMediaTimingFunction(function));
|
||||
}
|
||||
}
|
||||
|
||||
self.mbglMap.easeTo(cameraOptions, animationOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6460,7 +6476,7 @@ static void *windowScreenContext = &windowScreenContext;
|
||||
if (headingDirection >= 0 && self.userTrackingMode == MLNUserTrackingModeFollowWithHeading
|
||||
&& self.userTrackingState != MLNUserTrackingStateBegan)
|
||||
{
|
||||
[self _setDirection:headingDirection animated:YES];
|
||||
[self _setDirection:headingDirection center:self.userLocation.coordinate animated:YES];
|
||||
[self updateUserLocationAnnotationView];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user