mapbox / mapbox/mapbox-gl-js

setPaintProperty transition for feature-state case

Open
#7,121 5 comments 25 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**:

### Question

There doesn't seem to be transition when using setPaintProperty with case, is there an option to add transition?

My code:

```
this.map.setPaintProperty("seats-layer", "fill-color", ["case",
["boolean", ["feature-state", "hovered"], false],
"#ff6347",
["boolean", ["feature-state", "selected"], false],
"#32CD32",
["boolean", ["feature-state", "unavailable"], false],
"#808080",
"#ffffff"
]);
```

### Links to related documentation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the setPaintProperty entry point and trace how the supplied fill-color case expression uses feature-state. Reproduce the example to compare direct paint-property changes with feature-state changes, then inspect the related transition documentation. Done means the supported behavior or required transition handling is clearly established and covered by the relevant documentation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.