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)
  • Loading branch information
MaximAlien authored Jul 6, 2022
1 parent 17b403b commit 8e7485d
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 @@ -56,6 +56,7 @@
* Fixed an issue where popped window doesn't get updated in appearance when style changes on phone. ([#3954](https://github.com/mapbox/mapbox-navigation-ios/pull/3954))
* 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 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 @@ -1083,6 +1083,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 8e7485d

Please sign in to comment.