Support custom layers in setStyle
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
Custom layers are great, but it seems like one can only be added with `addLayer`. However many vdom applications use `setStyle` 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:
1. match up the layer by id and then do an equality check - if it doesn't match remove the old and add the new.
2. Add `diff(otherLayer) -> patch` and `patch(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
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 by tracing the setStyle and addLayer entry points to understand how custom layers are currently replaced. Compare the proposed layer-by-id equality approach with the optional diff and patch alternative. Done should mean setStyle can manage custom layers without making them disappear, with the chosen behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100