geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Can't cut drawn circle #1016

Closed vonadz closed 2 years ago

vonadz commented 2 years ago

I can't seem to use the cut tool to cut a drawn circle into a desired shape. As an example, I'm unable to use the geoman draw circle tool to draw a circle, then use the cut tool to cut it into a semi-circle. Is this not meant to be supported? I can't find any information in open/closed issues or in the documentation.

This seems to not work with the default codepen at: https://jsfiddle.net/o1dwu2vg/

Falke-Design commented 2 years ago

From the doku: https://github.com/geoman-io/leaflet-geoman#cut-mode

Enables drawing for the shape "Cut" to draw a polygon that gets subtracted from all underlying polygons. This way you can create holes, cut polygons or polylines in half or remove parts of it.

A Circle is not a Polyline / Polygon so it can't be cutted. A workaround for you would be to convert the circle to polygon with L.PM.circleToPolygon(circle, sides) (doku) and then cut it.