diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-01 10:00:36 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-04 14:45:32 +0200 |
commit | 586b22c0df99dec7e2089ba938cfbd8f96b3ce18 (patch) | |
tree | 27b614da853bb7f1db0e0ea5f7eaa10534ca4f4e /platform/macos | |
parent | ba7427b4acf116aca7451ad3a6067dc234d3fa70 (diff) | |
download | qtlocation-mapboxgl-586b22c0df99dec7e2089ba938cfbd8f96b3ce18.tar.gz |
[core] Remove map coordinate setters/getters
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 5f613922d8..8ebf6356cb 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -996,7 +996,7 @@ public: - (CLLocationCoordinate2D)centerCoordinate { mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets); - return MGLLocationCoordinate2DFromLatLng(_mbglMap->getLatLng(padding)); + return MGLLocationCoordinate2DFromLatLng(*_mbglMap->getCameraOptions(padding).center); } - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate { @@ -1007,9 +1007,10 @@ public: - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate animated:(BOOL)animated { MGLLogDebug(@"Setting centerCoordinate: %@ animated: %@", MGLStringFromCLLocationCoordinate2D(centerCoordinate), MGLStringFromBOOL(animated)); [self willChangeValueForKey:@"centerCoordinate"]; - _mbglMap->setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate), - MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets), - MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0)); + _mbglMap->easeTo(mbgl::CameraOptions() + .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) + .withPadding(MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets)), + MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0)); [self didChangeValueForKey:@"centerCoordinate"]; } @@ -1359,7 +1360,7 @@ public: - (MGLMapCamera *)cameraForCameraOptions:(const mbgl::CameraOptions &)cameraOptions { mbgl::CameraOptions mapCamera = _mbglMap->getCameraOptions(); - CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : _mbglMap->getLatLng()); + CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : *mapCamera.center); double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel; CLLocationDirection direction = cameraOptions.bearing ? mbgl::util::wrap(*cameraOptions.bearing, 0., 360.) : self.direction; CGFloat pitch = cameraOptions.pitch ? *cameraOptions.pitch : *mapCamera.pitch; |