Leaflet.FreeDraw
Leaflet.FreeDraw copied to clipboard
How to change the color
Hi,
I like very much this library! and I need to change the fill color of the polygon, May I ask how to modify it now??
i use the leaflet-freedraw.iife.js library, everything is fine except that there is no Attach Elbows button, why?
Override the css? .leaflet-polygon { fill: #ff0000; fill-opacity: 0.5; stroke: #50622b; }
So for this issue, I think that the suspect line is over here in line 73 to line 75 of helpers/polygon.js
: https://github.com/Wildhoney/Leaflet.FreeDraw/blob/master/src/helpers/Polygon.js#L73
Based on this, it seems as if the options are passed directly to the polygon. Therefore, if you modify the options that u pass into the FreeDraw Layer like
options.color = "red"
, then your polygon colour should be able to change.