Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide user course view in case if current user location coordinate point is invalid. #3988

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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