-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support custom layers in setStyle #7576
Comments
I don't believe this is a duplicate unless I misunderstand that issue. I think what I'm asking is: Currently to add a custom layer one does:
I'm asking to also support:
(This is a toy example, normally that would include a whole bunch of other sources and layers. |
Does The custom layer type is a mapbox-gl-js specific runtime type, and not a part of the Style specification. The style-spec is used for rendering maps across multiple platforms and does not include any types that are platform dependent. Adding support for that type in a |
Yes. I see your point. However, when using mapboxgl using reactive style programming* (usually through a wrapper), using the * By reactive I mean where the programmer writes a function from the application state to a style spec object and the runtime takes care of updating the map accordingly. |
Motivation
Custom layers are great, but it seems like one can only be added with
addLayer
. However many vdom applications usesetStyle
to manage changes with layers. This seems to be overwriting the custom layer which then disappears.Design Alternatives
Ideally,
setStyle
could be used with custom layers. However, there is a question of how diffing should work. I think there are two alternatives:diff(otherLayer) -> patch
andpatch(patch)
optional methods on custom layers. This would allow for possibly more performant mutation, but would make for much more API surface.Design
I think going with option 1 would be a lot simpler in the short run, and waiting to see demand for something more complicated would help.
Mock-Up
Concepts
Implementation
The text was updated successfully, but these errors were encountered: