Support loading icons asynchronously on styleimagemissing
@ansis is already working on this.
Since Oct 15, 2019.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Update: Design proposals that close this issue are in https://github.com/mapbox/mapbox-gl-js/issues/9018.
mapbox-gl-js version: 1.0.0
browser: Chrome 75.0.3770.80
Steps to Trigger Behavior
- Load a map with a style containing a layer that has a missing icon-image
- Attach to the styleimagemissing event and load an image for the missing icon-image
Link to Demonstration
This codepen demonstrates the behaviour: https://codepen.io/anon/pen/OeLYqW
It does the following:
- Loads the streets-v11 style JSON (via the API)
- Appends a symbol layer to the style's layers. This new layer re-uses an existing source layer (composite -> roads) but the icon-image is set to an non-existent value
- It also attaches to the 'styleimagemissing' event and loads up a valid image when it fires.
- Once the map has loaded, it waits 1.5 seconds then outputs how many features have been rendered from the test layer.
When you reload the codepen (reload the entire browser tab) you should see the number of features rendered is basically random. The correct answer (which you can see by changing the code-pen and setting the 'icon-image' property to e.g. beer-11 which is an image from the sprite) is 21, but I saw results like 0, 4, 23,24,25 (not sure how there is more!)
Expected Behavior
Features should render properly at initial zoom and all other zooms
Actual Behavior
On initial load, the features with the missing icon render seemingly at random.
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.
Assessment
This issue has not been assessed yet.