From 0226a0f81aa492dc22f6b3bff0a888400adddd34 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Tue, 22 Jan 2019 16:19:08 -0800 Subject: [ios] Fix wrong coordinates bounds when setting direction. (#13761) Fixes an issue calculating the view port when setting visible coordinates with a direction. --- platform/ios/CHANGELOG.md | 1 + platform/ios/src/MGLMapView.mm | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 9212b97c9a..201c347daf 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -11,6 +11,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Added the `-[MGLShapeSource leavesOfCluster:offset:limit:]`, `-[MGLShapeSource childrenOfCluster:]`, `-[MGLShapeSource zoomLevelForExpandingCluster:]` methods for inspecting a cluster in an `MGLShapeSource`s created with the `MGLShapeSourceOptionClustered` option. Feature querying now returns clusters represented by `MGLPointFeatureCluster` objects (that conform to the `MGLCluster` protocol). ([#12952](https://github.com/mapbox/mapbox-gl-native/pull/12952) * `MGLMapView` no longer freezes on external displays connected through AirPlay or CarPlay when the main device’s screen goes to sleep or the user manually locks the screen. ([#13701](https://github.com/mapbox/mapbox-gl-native/pull/13701)) * Fixed a bug where selecting partially on-screen annotations (without a callout) would move the map. ([#13727](https://github.com/mapbox/mapbox-gl-native/pull/13727)) +* Fixed an issue calculating the viewport when setting visible coordinates with a `direction`. ([#13761](https://github.com/mapbox/mapbox-gl-native/pull/13761)) ## 4.7.1 - December 21, 2018 diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index b3b8c8777d..e473bc1c0e 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3329,12 +3329,10 @@ public: { latLngs.push_back({coordinates[i].latitude, coordinates[i].longitude}); } + + CLLocationDirection cameraDirection = direction >= 0 ? direction : 0; - mbgl::CameraOptions cameraOptions = self.mbglMap.cameraForLatLngs(latLngs, padding); - if (direction >= 0) - { - cameraOptions.angle = direction; - } + mbgl::CameraOptions cameraOptions = self.mbglMap.cameraForLatLngs(latLngs, padding, cameraDirection); mbgl::AnimationOptions animationOptions; if (duration > 0) -- cgit v1.2.1