Leaflet.FreeDraw icon indicating copy to clipboard operation
Leaflet.FreeDraw copied to clipboard

How to change the color

Open yansf opened this issue 5 years ago • 3 comments

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??

yansf avatar Oct 15 '19 08:10 yansf

i use the leaflet-freedraw.iife.js library, everything is fine except that there is no Attach Elbows button, why?

yansf avatar Oct 15 '19 09:10 yansf

Override the css? .leaflet-polygon { fill: #ff0000; fill-opacity: 0.5; stroke: #50622b; }

AndreasOlausson avatar Oct 17 '19 19:10 AndreasOlausson

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.

virtuoso98 avatar Jun 20 '21 14:06 virtuoso98