When i create a new Polygon, on "PM:DRAWSTART" i initialize event "pm:vertexadded"
It's allow me to detect if:
- New point is inside an existing polygons, so i remove it. *
- If last line created intersect with an existing polygons ( TurfJS lineIntersect ), i remove it.
If last line created "kinks" ( TurfJS also ) , i remove it.
I use : "map.pm.Draw["Polygon"]._removeLastVertex();" to remove last point.
My problem.
When polygon is closed (last point click on first one) "PM:DRAWEND" event is executed. So in this case i'm not able to check if the new polygon is overlaping an existing one as i do with event "pm:vertexadded".
Is it possible on event "PM:CREATE" if the new polygon is overlaping an existing one to go in edit mode ( polygon.toggleEdit() ) and go back on stage as i don't click on the last point to close the polygon.
Many thanks.