From 246d956bad12fdfb87cc74aea137bebd0d5205b0 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Thu, 9 Nov 2017 13:58:22 -0500 Subject: [PATCH 1/4] [ios] Fix toCamera.centerCoordinate in shouldChangeFromCamera has same center as oldCamera. --- platform/ios/src/MGLMapView.mm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index c960c60c789..ad4a251e050 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1816,16 +1816,18 @@ - (MGLMapCamera *)cameraByPanningWithTranslation:(CGPoint)endPoint panGesture:(U 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)); + + MGLMapCamera *camera; + camera = [self cameraThatFitsCoordinateBounds:bounds]; return camera; } From d62d70e2967c771b27950bf23f19505f543bd0b5 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 10 Nov 2017 17:35:09 -0500 Subject: [PATCH 2/4] [ios] Update changelog. --- platform/ios/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index d449379ea6e..455881a5bc0 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 that causes `mapView:shouldChangeFromCamera:toCamera:` delegate pass the wrong `centerCoordinate` in `toCamera` parameter. ([#10433](https://github.com/mapbox/mapbox-gl-native/pull/10433)) ### Other changes From edfd73d744bbca0aaa1a11eb173c6c7ef5749635 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Mon, 13 Nov 2017 10:08:51 -0500 Subject: [PATCH 3/4] [ios] Remove unnecessary variables. --- platform/ios/src/MGLMapView.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index ad4a251e050..1d89099d74f 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1826,10 +1826,7 @@ - (MGLMapCamera *)cameraByZoomingToZoomLevel:(double)zoom aroundAnchorPoint:(CGP currentCameraOptions.anchor = anchor; MGLCoordinateBounds bounds = MGLCoordinateBoundsFromLatLngBounds(_mbglMap->latLngBoundsForCamera(currentCameraOptions)); - MGLMapCamera *camera; - camera = [self cameraThatFitsCoordinateBounds:bounds]; - - return camera; + return [self cameraThatFitsCoordinateBounds:bounds]; } - (MGLMapCamera *)cameraByRotatingToDirection:(CLLocationDirection)degrees aroundAnchorPoint:(CGPoint)anchorPoint From f05ab376636573e513f0235cfd300991407c9e54 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Tue, 14 Nov 2017 09:30:49 -0500 Subject: [PATCH 4/4] [ios] Clarify changelog doc. --- platform/ios/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 455881a5bc0..147567da193 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -37,7 +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 that causes `mapView:shouldChangeFromCamera:toCamera:` delegate pass the wrong `centerCoordinate` in `toCamera` parameter. ([#10433](https://github.com/mapbox/mapbox-gl-native/pull/10433)) +* 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