Wildhoney / Leaflet.FreeDraw

:earth_asia: FreeDraw allows the free-hand drawing of shapes on your Leaflet.js map layer – providing an intuitive and familiar UX for creating geospatial boundaries similar to Zoopla and others. Included out-of-the-box is the concaving of polygons, polygon merging and simplifying, as well as the ability to add edges and modify existing shapes.
https://freedraw.herokuapp.com/
MIT License
540 stars 102 forks source link

How to change the color #158

Open yansf opened 4 years ago

yansf commented 4 years ago

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 commented 4 years ago

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

AndreasOlausson commented 4 years ago

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

virtuoso98 commented 3 years ago

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.