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/ios/src | |
parent | ba7427b4acf116aca7451ad3a6067dc234d3fa70 (diff) | |
download | qtlocation-mapboxgl-586b22c0df99dec7e2089ba938cfbd8f96b3ce18.tar.gz |
[core] Remove map coordinate setters/getters
Diffstat (limited to 'platform/ios/src')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 3de6e06e4d..3eeffb9cbd 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1697,8 +1697,10 @@ public: if (self.userTrackingMode == MGLUserTrackingModeNone && pinch.numberOfTouches == _previousPinchNumberOfTouches) { CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; - self.mbglMap.setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate), - mbgl::EdgeInsets { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }); + mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; + self.mbglMap.jumpTo(mbgl::CameraOptions() + .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) + .withPadding(padding)); } } [self cameraIsChanging]; @@ -3177,7 +3179,7 @@ public: - (CLLocationCoordinate2D)centerCoordinate { mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(self.contentInset); - return MGLLocationCoordinate2DFromLatLng(self.mbglMap.getLatLng(padding)); + return MGLLocationCoordinate2DFromLatLng(*self.mbglMap.getCameraOptions(padding).center); } - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel animated:(BOOL)animated @@ -3795,7 +3797,7 @@ public: } mbgl::CameraOptions mapCamera = self.mbglMap.getCameraOptions(); - CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : self.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; |