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 | |
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')
-rw-r--r-- | platform/ios/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 13 |
2 files changed, 7 insertions, 7 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index d449379ea6..147567da19 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -37,6 +37,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Users of VoiceOver can now swipe left and right to navigate among visible places, points of interest, and roads. ([#9950](https://github.com/mapbox/mapbox-gl-native/pull/9950)) * Increased the default maximum zoom level from 20 to 22. ([#9835](https://github.com/mapbox/mapbox-gl-native/pull/9835)) +* Fixed an issue where the same value was passed in as the `oldCamera` and `newCamera` parameters to the `-[MGLMapViewDelegate mapView:shouldChangeFromCamera:toCamera:]` method. ([#10433](https://github.com/mapbox/mapbox-gl-native/pull/10433)) ### Other changes 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 |