Skip to content

Commit

Permalink
Hide user course view in case if current user location coordinate poi…
Browse files Browse the repository at this point in the history
…nt is invalid. (#3988)

Cherry-picked 8e7485d.
  • Loading branch information
MaximAlien committed Jul 6, 2022
1 parent 321892e commit dc48c57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* Fixed an issue where detailed feedback items don't change color in different style. ([#3954](https://github.com/mapbox/mapbox-navigation-ios/pull/3954))
* Update method deprecation for `HistoryRecording` protocol. Static methods are now preferred over instance ones. ([#3960](https://github.com/mapbox/mapbox-navigation-ios/pull/3960))
* Fixed a bug which sometimes caused the crash when new continuous alternatives arrive. ([#3986](https://github.com/mapbox/mapbox-navigation-ios/pull/3986))
* Fixed an issue where `UserPuckCourseView` is drawn in incorrect position if its location is outside of the bounds of `MapView`. ([#3988](https://github.com/mapbox/mapbox-navigation-ios/pull/3988))

## v2.5.1

Expand Down
9 changes: 9 additions & 0 deletions Sources/MapboxNavigation/NavigationMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,15 @@ open class NavigationMapView: UIView {
from previousLocation: CLLocation? = nil,
to location: CLLocation,
animated: Bool = false) {
// If the point is outside of the bounds of `MapView` - hide user course view.
let point = mapView.mapboxMap.point(for: location.coordinate)
if point.x == -1.0 && point.y == -1.0 {
userCourseView.isHidden = true
return
} else {
userCourseView.isHidden = false
}

if let previousLocation = previousLocation {
let point = mapView.mapboxMap.point(for: previousLocation.coordinate)
userCourseView.center = point
Expand Down

0 comments on commit dc48c57

Please sign in to comment.