[ios, osx] Fixed direction, pitch restoration
Followup to #4790. Fixed a regression preventing the direction and pitch from being persisted across sessions.
This commit is contained in:
committed by
Minh Nguyễn
parent
466ed55200
commit
df0d1187da
@@ -2141,8 +2141,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|
||||
{
|
||||
CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : _mbglMap->getLatLng());
|
||||
double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel;
|
||||
CLLocationDirection direction = cameraOptions.angle ? *cameraOptions.angle : self.direction;
|
||||
CGFloat pitch = cameraOptions.pitch ? *cameraOptions.pitch : _mbglMap->getPitch();
|
||||
CLLocationDirection direction = cameraOptions.angle ? -MGLDegreesFromRadians(*cameraOptions.angle) : self.direction;
|
||||
CGFloat pitch = cameraOptions.pitch ? MGLDegreesFromRadians(*cameraOptions.pitch) : _mbglMap->getPitch();
|
||||
CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitch, centerCoordinate.latitude, self.frame.size);
|
||||
return [MGLMapCamera cameraLookingAtCenterCoordinate:centerCoordinate fromDistance:altitude pitch:pitch heading:direction];
|
||||
}
|
||||
|
||||
@@ -1150,8 +1150,8 @@ public:
|
||||
- (MGLMapCamera *)cameraForCameraOptions:(const mbgl::CameraOptions &)cameraOptions {
|
||||
CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : _mbglMap->getLatLng());
|
||||
double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel;
|
||||
CLLocationDirection direction = cameraOptions.angle ? *cameraOptions.angle : self.direction;
|
||||
CGFloat pitch = cameraOptions.pitch ? *cameraOptions.pitch : _mbglMap->getPitch();
|
||||
CLLocationDirection direction = cameraOptions.angle ? -MGLDegreesFromRadians(*cameraOptions.angle) : self.direction;
|
||||
CGFloat pitch = cameraOptions.pitch ? MGLDegreesFromRadians(*cameraOptions.pitch) : _mbglMap->getPitch();
|
||||
CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitch,
|
||||
centerCoordinate.latitude,
|
||||
self.frame.size);
|
||||
|
||||
Reference in New Issue
Block a user