diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-11-14 13:37:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-14 13:37:45 -0500 |
commit | addefe539ac6ad94e4d8526f3cc1da2114ac0585 (patch) | |
tree | 8ec971e60119bcebc643b32e16213a3468d4609e /platform/ios/src | |
parent | f0f113bafc49a735a596357a0982e298648f4d48 (diff) | |
download | qtlocation-mapboxgl-addefe539ac6ad94e4d8526f3cc1da2114ac0585.tar.gz |
[ios] Fix toCamera.centerCoordinate in shouldChangeFromCamera (#10433)
* [ios] Fix toCamera.centerCoordinate in shouldChangeFromCamera has same center as oldCamera.
* [ios] Update changelog.
* [ios] Remove unnecessary variables.
* [ios] Clarify changelog doc.
Diffstat (limited to 'platform/ios/src')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index c002da5f18..41d900702b 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1801,18 +1801,17 @@ public: return panCamera; } -- (MGLMapCamera *)cameraByZoomingToZoomLevel:(double)zoom aroundAnchorPoint:(CGPoint)anchorPoint +- (MGLMapCamera *)cameraByZoomingToZoomLevel:(double)zoom aroundAnchorPoint:(CGPoint)anchorPoint { - mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(self.contentInset); - mbgl::CameraOptions currentCameraOptions = _mbglMap->getCameraOptions(padding); - MGLMapCamera *camera; - mbgl::ScreenCoordinate anchor = mbgl::ScreenCoordinate { anchorPoint.x, anchorPoint.y }; + mbgl::EdgeInsets padding = mbgl::EdgeInsets(anchor.y, anchor.x, self.size.height - anchor.y, self.size.width - anchor.x); + mbgl::CameraOptions currentCameraOptions = _mbglMap->getCameraOptions(padding); + currentCameraOptions.zoom = mbgl::util::clamp(zoom, self.minimumZoomLevel, self.maximumZoomLevel); currentCameraOptions.anchor = anchor; - camera = [self cameraForCameraOptions:currentCameraOptions]; + MGLCoordinateBounds bounds = MGLCoordinateBoundsFromLatLngBounds(_mbglMap->latLngBoundsForCamera(currentCameraOptions)); - return camera; + return [self cameraThatFitsCoordinateBounds:bounds]; } - (MGLMapCamera *)cameraByRotatingToDirection:(CLLocationDirection)degrees aroundAnchorPoint:(CGPoint)anchorPoint |