Skip to content

Commit

Permalink
vk-844-access-restrictions: fixed CarPlay displaying restricted areas
Browse files Browse the repository at this point in the history
  • Loading branch information
Udumft committed Nov 30, 2021
1 parent a5cf5a8 commit 2cdf5cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Example/AppDelegate+CarPlay.swift
Expand Up @@ -92,6 +92,7 @@ extension AppDelegate: CarPlayManagerDelegate {

// Render part of the route that has been traversed with full transparency, to give the illusion of a disappearing route.
navigationViewController.routeLineTracksTraversal = true
navigationViewController.navigationMapView?.showsRestrictedAreasOnRoute = true

// Example of building highlighting in 3D.
navigationViewController.waypointStyle = .extrudedBuilding
Expand Down
2 changes: 2 additions & 0 deletions Example/ViewController.swift
Expand Up @@ -70,6 +70,7 @@ class ViewController: UIViewController {

// Show congestion levels on alternative route lines if there're multiple routes in the response.
navigationMapView.showsCongestionForAlternativeRoutes = true
navigationMapView.showsRestrictedAreasOnRoute = true
navigationMapView.show(prioritizedRoutes)
navigationMapView.showWaypoints(on: prioritizedRoutes.first!)
navigationMapView.showRouteDurations(along: prioritizedRoutes)
Expand Down Expand Up @@ -545,6 +546,7 @@ class ViewController: UIViewController {
present(navigationViewController, animated: true) {
completion?()
self.navigationMapView = nil
navigationViewController.navigationMapView?.showsRestrictedAreasOnRoute = true
}
}

Expand Down
7 changes: 4 additions & 3 deletions Sources/MapboxNavigation/NavigationMapView.swift
Expand Up @@ -39,10 +39,11 @@ open class NavigationMapView: UIView {
Restricted areas are drawn using `routeRestrictedAreaColor` which is customizable.
*/
public var showsRestrictedAreasOnRoute: Bool = true//false
{
public var showsRestrictedAreasOnRoute: Bool = false {
didSet {
updateRestrictedAreasGradientStops(along: self.routes?.first)
if let routes = self.routes {
show(routes, legIndex: self.currentLegIndex)
}
}
}

Expand Down

0 comments on commit 2cdf5cd

Please sign in to comment.