Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map.setPaintProperty() fill-color not redrawing after modifying stops #5802

Closed
jhurlb opened this issue Dec 4, 2017 · 3 comments
Closed

Comments

@jhurlb
Copy link

jhurlb commented Dec 4, 2017

mapbox-gl-js version:
0.42.1 & 0.42.2

Steps to Trigger Behavior

  1. Create a layer with paint property 'fill-color' and give it a range of stops
  2. Modify the stops color and call map.setPaintProperty() with the new stops
  3. Observe 1 of 2 outcomes: Either the layer redraws only once and not again, or the layer does not redraw at all.

Expected Behavior

When modifying stops and calling map.setPaintProperty() the layer should redraw with the correct stops colors

Actual Behavior

When modifying stops and calling map.setPaintProperty() the layer redraws only once or not at all

Fiddles:
0.42.0 - WORKS
https://jsfiddle.net/bmdqb0nv

0.42.1 - BROKEN
https://jsfiddle.net/9qj1szd6

0.42.2 - BROKEN
https://jsfiddle.net/a7qo64s2

Workaround

call map.setPaintProperty(<layer name>, 'fill-color'); before using the new stops.

@mollymerp
Copy link
Contributor

thanks for the thorough report @justinhurlburt. this bisects to 7e87d7c

@mollymerp
Copy link
Contributor

this line 7e87d7c#diff-0fcf9ef37a1614185cad0dcbd5ec5529L775 is always returning true in the current code, so _updateLayer is never called. it seems the style is already updated before layer.setPaintProperty is called 💭
cc @jfirebaugh

@jfirebaugh jfirebaugh self-assigned this Dec 4, 2017
@jfirebaugh
Copy link
Contributor

As a workaround, avoid updating fillColor.stops in place -- generate a fresh array for each setPaintProperty call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants