Repository navigation
Description
When the user taps the Overview button, the course view slides around quite noticeably. It doesn’t settle into the correct position on screen until after the map view’s camera animates to completion. This sliding effect destroys the visual illusion of the course view being “stuck to” a geographic location on the map.
NavigationMapView.setOverheadCameraView(from:along:for:) zooms out here using MGLMapView’s built-in camera animation functionality:
| setVisibleCoordinateBounds(line.overlayBounds, edgePadding: bounds, animated: true) |
Most likely, this method should also set a flag that causes RouteMapViewController’s implementation of NavigationMapViewDelegate.mapViewRegionIsChanging(_:) to update the course view’s position without animation, similar to this code that runs whenever the location changes:
mapbox-navigation-ios/MapboxNavigation/NavigationMapView.swift
Lines 345 to 347 in d8beeba
| UIView.animate(withDuration: duration, delay: 0, options: [.curveLinear, .beginFromCurrentState], animations: { | |
| self.userCourseView?.center = self.convert(location.coordinate, toPointTo: self) | |
| }, completion: nil) |
(It’s a little unfortunate that the course view is laid out in NavigationMapView itself but has to be synchronized by the map view’s delegate. One solution would be to move the course view functionality into RouteMapViewController. Another would be for MGLMapView to expose the internal method that calls MGLMapViewDelegate.mapViewRegionIsChanging(_:).)
This issue has been present probably since we converted the course view from a view-backed annotation to a manually synchronized view in #402. The issue doesn’t affect the Android navigation SDK, which implements the course view as a feature in a GeoJSON source.
/cc @mapbox/navigation-ios
Activity