Skip to content

Commit 24b4090

Browse files
authored
Fix incorrect initial puck position (#3773)
* Fix incorrect initial puck position * Add changelog
1 parent 76a6152 commit 24b4090

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Fixed an issue where the route line appeared to begin away from the user’s current location after the route was refreshed. ([#3781](https://github.com/mapbox/mapbox-navigation-ios/pull/3781))
2727
* Fixed a memory leak after ending a turn-by-turn navigation session. ([#3782](https://github.com/mapbox/mapbox-navigation-ios/pull/3782))
2828
* Fixed an issue when `SimulatedLocationManager` could freeze the main thread when working with long routes. The manager now calls delegate methods from a background thread. ([#3672](https://github.com/mapbox/mapbox-navigation-ios/pull/3672))
29+
* Fixed an issue where initial puck position can be incorrect when `NavigationViewController` is presented. ([#3773](https://github.com/mapbox/mapbox-navigation-ios/pull/3773))
2930

3031
### Offline routing
3132

Sources/MapboxNavigation/CarPlayNavigationViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,8 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti
393393
public override func viewDidLoad() {
394394
super.viewDidLoad()
395395

396-
setupNavigationMapView()
397396
setupOrnaments()
397+
setupNavigationMapView()
398398
setupStyleManager()
399399

400400
observeNotifications(navigationService)

Sources/MapboxNavigation/NavigationMapView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ open class NavigationMapView: UIView {
18631863
*/
18641864
func setInitialCamera(_ coordinate: CLLocationCoordinate2D) {
18651865
guard let navigationViewportDataSource = navigationCamera.viewportDataSource as? NavigationViewportDataSource else { return }
1866-
1866+
layoutIfNeeded() // mapView isn't able to properly convert coordinates before layout.
18671867
mapView.mapboxMap.setCamera(to: CameraOptions(center: coordinate,
18681868
zoom: CGFloat(navigationViewportDataSource.options.followingCameraOptions.zoomRange.upperBound)))
18691869
moveUserLocation(to: CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude))

0 commit comments

Comments
 (0)