Skip to content

Fix feature-state dependent styles for *-pattern properties #7207

@mollymerp

Description

@mollymerp

per #6289 (comment)

In the recent addition of data-driven styling support for *-pattern properties, feature-state dependent expressions do not work. The removal of the possibleOutputs state (#6289 (comment)) makes it possible that the icons needed forfeature-state related paint array updates may not be available in the tile's ImageAtlas at update time.

We haven't run into this before because the other data-driven properties that require glyph/icon assets are layout properties which don't support feature-state expressions yet.

I see a couple options on how to fix this:

  • request new images in the CrossFadedCompositeBinder#updatePaintArrays method that runs on the main thread when feature states are updated/changed and update the tile's ImageAtlas
    • 👎 binder would need access to ImageManager, binder would have to send the new ImageAtlas to the tile somehow
  • pass available feature-states to the buckets at parse time so the expressions can be evaluated with feature state and all needed images can be requested
    • 👎 additional payload on worker thread transfer, doesn't cover the case where no features have the state value that is used in the expression when it is set as a paint property
  • reintroduce possibleOutputs state and require that feature-state dependent expressions for cross-faded-data-driven properties be contained as literals
    • 👎 lots of special-case logic and behavior, might be confusing/unexpected to users
  • not support feature-state expressions for cross-faded-data-driven properties
    • 👎 this is the current behavior, but it fails silently

leaning towards the first option here, but curious if anyone has a different preference or another idea.
cc @asheemmamoowala @jfirebaugh

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions