Adding symbol icon layer before adding icons causes icons not to render at initial zoom
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Apologies for the long title, this is a bit of a strange one and it took me a while to pin down and consistently reproduce.
Reproduction: https://jsbin.com/wigirelagu/edit?html,output (add your access token at the top of the script)
This is based on https://www.mapbox.com/mapbox-gl-js/example/add-image/ with a few changes.
**mapbox-gl-js version**: 0.44.1
### Steps to Trigger Behavior
* Create a symbol layer that uses image icons
* Add this layer to your map before you add the images that that layer uses
### Expected Behavior
Icons appear at any zoom level and regardless of when the layer was added.
### Actual Behavior
Icons don't appear on the map unless you zoom away from the zoom level that the map initially loads with. This applies to the entire integer zoom level; since the reproduction has an initial zoom of 7, the icons will be hidden when your zoom level is anywhere between 7 and 8.
Adding the layer after the icons are added works around the issue (you can try this in the repro), but it seems like this should work either way.
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
Run the linked JSBin reproduction with a Mapbox access token, then compare it with the add-image example and the two layer/image insertion orders described in the issue. Investigate the symbol rendering path responsible for the initial integer zoom and verify that icons render at the initial zoom without requiring a zoom change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100