I am trying to let the user choose their paint color and then paint polygon on map. I know there is a setFeatureProperty method, but it needs to pass in a feature ID and thus user will need to draw the shape first and then change style. Is there anyway to just change to draw style programmably for future drawing? Any help is appreciated.
Mapbox-gl-draw change drawing style after click a button
1.4k views Asked by Zijian Zhang At
1
Based on the Gist https://gist.github.com/dnseminara/0790e53cef9867e848e716937727ab18
It's possible to get feature ID:
I've made this Jsfidle:
https://jsfiddle.net/ToniBCN/y79ajgrw/3/
Maybe it could help you because it's easy to change feature color before draw and not after like the example.