Skip to content

Allow 'feature-state' expressions on 'layout' or 'filter' properties #13464

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

Open
jonshutt opened this issue Apr 25, 2025 · 0 comments
Open

Allow 'feature-state' expressions on 'layout' or 'filter' properties #13464

jonshutt opened this issue Apr 25, 2025 · 0 comments

Comments

@jonshutt
Copy link

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 'paint' 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant