mapbox / mapbox/mapbox-gl-js

setData causes symbols to flicker when -allow-overlap is set to false

Open
#6,052 13 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

**mapbox-gl-js version**: v0.43.0 and master

### Steps to Trigger Behavior

1. create a symbol layer with -allow-overlap set to false
2. animate the positions of features using setData

I can reproduce with https://www.mapbox.com/mapbox-gl-js/example/animate-point-along-route/

This bug is only reproducible when the updates are spaced further apart (when the rendering is slower). I can reproduce more easily in Firefox.

### Expected Behavior

Feature is animated without flickering.

### Actual Behavior

Feature is animated with flickering.

---

The feature is flickering because it was moved far enough from the original feature that the `CrossTileSymbolIndex` isn't able to match it with the previous symbol. Since it is treated as a new symbol it doesn't have an opacity to copy over and so it isn't visible until the next placement happens.

Possible fixes:
- force new placement after setData (the way backwards)
- come up with a way for users to specify keys used to match symbols (the way forwards)

cc @ChrisLoer

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

Reproduce the issue with the animate-point-along-route example using a symbol layer with allow-overlap set to false and spaced setData updates. Read the CrossTileSymbolIndex handling described in the issue and trace how moved symbols receive opacity during placement. Done means animated features no longer flicker, including in slower rendering conditions and Firefox.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.