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

setPaintProperty not work on click event #8273

Closed
longwind91 opened this issue May 22, 2019 · 3 comments
Closed

setPaintProperty not work on click event #8273

longwind91 opened this issue May 22, 2019 · 3 comments
Assignees
Labels

Comments

@longwind91
Copy link

mapbox-gl-js version: 0.54.0

browser: chrome

Steps to Trigger Behavior

click map to excute setPaintProperty function, but it don't work, the property line-pattern not changed

Link to Demonstration

https://jsbin.com/rukoji/edit?js,output

Expected Behavior

change paint property, the line-pattern will be greenArrow

Actual Behavior

don't work, the line-pattern is still redArrow

@ahk
Copy link
Contributor

ahk commented May 24, 2019

Hi @longwind91, sorry I don't have better news but yes this is a bug and your code should work as you expect. I looked into this today and can reproduce this issue across as many browsers and platforms as I tested.

I have yet to find the source or explanation for the bug. I'll update this issue as soon as I do, hopefully with a workaround you can use while we integrate the fix.

Thank you for your submission (and your patience).

@ahk ahk self-assigned this May 24, 2019
@longwind91
Copy link
Author

Thanks for your reply. Looking forward to the bug being fixed

@ahk
Copy link
Contributor

ahk commented May 31, 2019

Hi @longwind91 we have integrated the fix. If you grab our newest source (and build mapbox-gl-js yourself) you could start using this immediately.

If you'd like to wait for our official release, in the meantime you can use a workaround. Place this immediately following any map.setPaintProperty(...) in your JSBin:

map.style._updateLayer(map.getLayer('line'))

The idea is to force "re-layout" on whatever layer you are updating, so for example if you had other layers you'd use their id string instead of 'line'.

Hope this helps, thanks for the report!

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

No branches or pull requests

3 participants