Formatted symbol text color not working if used with ["step", ["zoom"], ...] and `get` lookup
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 2.3.0
**browser**: Chrome 90.0.4430.212 (Official Build) (arm64)
### Steps to Trigger Behavior
1. Code a symbol layer with formatted text
2. Add step zoom expression and with a `get` lookup to the layer
3. Load map on browser
4. Zoom in
For the demo link below:
1. Load the demo page
2. Zoom to at least level 9.5 to see the transition
### Link to Demonstration
https://output.jsbin.com/yecupog/4
https://user-images.githubusercontent.com/2296/120460684-eb656400-c3cb-11eb-9ab7-4adb2d559a1c.mov
### Expected Behavior
`foo 2` label should change to `bar` **and** turn red when zoomed in.
### Actual Behavior
`foo 2` label changes to `bar` **but** doesn't turn red.
### Notes
In the demo linked above, I've added another symbol **without** `['get', 'name']`, the left `foo 1` label. The label color changes to red when zoomed in. I'm not sure if the bug is due to the `get` lookup but this is an unexpected bug nevertheless.
The key difference is between this (no bug):
``` js
9.5, ['format', 'bar', {'text-color': 'red'}],
```
and this (bug):
``` js
9.5, ['format', ['get', 'name'], {'text-color': 'red'}],
```
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 with the linked JSBin reproduction and compare the two symbol-layer expressions: the literal formatted text and the version using `['get', 'name']` inside the zoom `step`. Trace formatted symbol text color evaluation during the zoom transition. Done means the `foo 2` label changes to `bar` and turns red at zoom 9.5 or higher, matching the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100