-
Notifications
You must be signed in to change notification settings - Fork 313
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
Adjust the layer position to make puck layer at topmost #3106
Conversation
@@ -904,7 +905,9 @@ open class NavigationMapView: UIView { | |||
try mapView.mapboxMap.style.addSource(arrowSource, id: NavigationMapView.SourceIdentifier.arrowSource) | |||
arrowLayer.source = NavigationMapView.SourceIdentifier.arrowSource | |||
|
|||
if mapView.mapboxMap.style.sourceExists(withId: NavigationMapView.LayerIdentifier.waypointCircleLayer) { | |||
if allLayerIds.contains(NavigationMapView.LayerIdentifier.puck3DLayer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If layer already exists why're we adding it, instead of updating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is to check whether the 3D puck layer exists, if the 3D puck layer exists, we add the arrowLayer
below the puck3D layer. It's the same case for arrowSymbolLayer
, to add it below the 3D puck layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CarPlay issue with maneuvers should be related with the layerID problem as below , add the check of layer existence before set layer position. Similar issue happened for the way point circle layer.
The CarPlay has issue with adding maneuvers based on the following error, which leads to the abrupt stop of adding the
|
3899268
to
39092d7
Compare
@@ -929,7 +932,11 @@ open class NavigationMapView: UIView { | |||
|
|||
try mapView.mapboxMap.style.addSource(arrowStrokeSource, id: NavigationMapView.SourceIdentifier.arrowStrokeSource) | |||
arrowStrokeLayer.source = NavigationMapView.SourceIdentifier.arrowStrokeSource | |||
try mapView.mapboxMap.style.addLayer(arrowStrokeLayer, layerPosition: .above(mainRouteLayerIdentifier)) | |||
if allLayerIds.contains(mainRouteLayerIdentifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CarPlay
's issue with maneuvers should be related with the layerID problem here. Sometimes the mapView
could not find the mainRouteLayerIdentifier
. Thus add the check of layer existence before setting layer position. Similar issue happened for the waypoint circle layer.
Thanks for writing tests 👍 |
Tests/MapboxNavigationTests/NavigationViewControllerTests.swift
Outdated
Show resolved
Hide resolved
2013231
to
35e8a79
Compare
Description
This pr is to fix #3098 , because the 3D puck from map side doesn't support the default topmost layer position similar as 2D puck. This pr is to check the 3D puck layer and make it above the maneuvers when we call
func navigationMapView.addArrow
.Implementation
Because the 3D puck from map side doesn't support the default topmost layer position similar as 2D puck. This pr is to check the 3D puck layer and make it above the maneuvers when we call
func navigationMapView.addArrow
Screenshots or Gifs