trafficonese / leaflet.extras

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras/
GNU General Public License v3.0
216 stars 74 forks source link

lineCap/lineJoin options? #80

Closed lauren-oldham closed 7 years ago

lauren-oldham commented 7 years ago

I have some questions about the lineCap and lineJoin drawShapeOptions in the draw polygons functionality of leaflet.extras.

When you draw polygons with this tool, each vertex is marked with a white square by default. Is this square the lineCap or the lineJoin (or neither?). Furthermore, what are the string options for lineCap and lineJoin? I would figure they'd be something like "circle," "square," or "point," but these options don't work for me. Can I change the style of the white square through these or other options?

bhaskarvk commented 7 years ago

The lineCap and lineJoin attributes are not for the white square that you see when drawing/editing the shapes. The white square is fixed in leaflet.draw plugin and I don't know of any way of changing that. The lineCap and lineJoin attributes affect how polyline and polygon borders are displayed. See this link https://stackoverflow.com/questions/10940316/how-to-use-attrs-stroke-dasharray-stroke-linecap-stroke-linejoin-in-raphaeljs.

If you want to see them in action set it to either 'butt' or 'round' or 'square' and set weight to 10 or 20, and draw a new polygon. You'll see that the way the borders are joined changes based on these two options.