Skip to content

Commit 8e7485d

Browse files
authored
Hide user course view in case if current user location coordinate point is invalid. (#3988)
1 parent 17b403b commit 8e7485d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* 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))
5757
* Fixed an issue where detailed feedback items don't change color in different style. ([#3954](https://github.com/mapbox/mapbox-navigation-ios/pull/3954))
5858
* Update method deprecation for `HistoryRecording` protocol. Static methods are now preferred over instance ones. ([#3960](https://github.com/mapbox/mapbox-navigation-ios/pull/3960))
59+
* 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))
5960

6061
## v2.5.1
6162

Sources/MapboxNavigation/NavigationMapView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,15 @@ open class NavigationMapView: UIView {
10831083
from previousLocation: CLLocation? = nil,
10841084
to location: CLLocation,
10851085
animated: Bool = false) {
1086+
// If the point is outside of the bounds of `MapView` - hide user course view.
1087+
let point = mapView.mapboxMap.point(for: location.coordinate)
1088+
if point.x == -1.0 && point.y == -1.0 {
1089+
userCourseView.isHidden = true
1090+
return
1091+
} else {
1092+
userCourseView.isHidden = false
1093+
}
1094+
10861095
if let previousLocation = previousLocation {
10871096
let point = mapView.mapboxMap.point(for: previousLocation.coordinate)
10881097
userCourseView.center = point

0 commit comments

Comments
 (0)