Allow 'feature-state' expressions on 'layout' or 'filter' properties
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
With a large dataset, we can dynamically use `setFeatureState` to change some aspects of how a feature is displayed without having to update the entire geojson source. However, this only works with the 'Paint' property.
` paint: {
'icon-opacity': ['case', ['boolean', ['feature-state', 'filtered'], false], 1,.5],
},`
This works well, but we can't use it for things like `text-size`, or `visibility` that are handled in the 'layout' property
### Mock-Up
`{
layout: {
'visibility': ['case', ['boolean', ['feature-state', 'filtered'], false], 'visible', 'none'],
}`
### Concepts
`setFeatureState` doesn't change, it's already setting data agnostic to how it will be used
Allowing layout and filters to use 'feature-state' standardises which option work between paint, filter, and layout
### 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 setFeatureState and the existing feature-state handling for paint properties, then compare how layout and filter properties are processed. Done means feature-state expressions support the requested layout and filter use cases, including the text-size and visibility examples described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100