mapbox / mapbox/mapbox-navigation-ios
NavigationMapView layers should be stylable
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 918
- Forks
- 326
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 3
Description
If you want to customize some aspect of the route line’s appearance on a NavigationMapView, you currently have to start a `NavigationViewControllerDelegate.navigationViewController(_:routeStyleLayerWithIdentifier:source:)` implementation from scratch, even if you only want to tweak a single property like the opacity. If you want the appearance to vary based on the currently active Style or map style, you have to root around for the map view or style manager and conditionally return a different layer. #1124 tried to simplify the customization story somewhat by factoring out `MBRouteLineWidthByZoomLevel`, but that only addresses a small part of the complexity.
The Style class should define a set of MGLLineStyleLayers that implement the default appearance. Then the developer can customize the appearance declaratively in a way that respects the currently active map style and UI appearance. NavigationMapView already has to reapply the runtime styling layers when the map style changes due to entering or exiting a tunnel, so now it can get a style-appropriate layer from the currently active Style instead of consulting the map view’s delegate. Instead of copy-pasting complex code, a Style subclass can take the superclass’s predefined layer and tweak individual properties as needed. The delegate styling methods would remain, though I’m unsure if they should take precedence over the layers defined by the currently active Style.
/cc @mapbox/navigation-ios
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with NavigationMapView styling and the Style class, then trace the navigationViewController(_:routeStyleLayerWithIdentifier:source:) delegate path and the runtime layer reapplication used when entering or exiting a tunnel. Review MBRouteLineWidthByZoomLevel and resolve how Style-provided layers and delegate styling should interact; done means the customization design is defined for active map styles and UI appearance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100