In my application using Leaflet.draw the user can set point markers on a map.
I would like to allow the setting only in a certain area.
The function isMarkerInsidePolygon(marker, polygon)
returns true, if the marker is inside the polygone, false if outside.
For this purpose, I think I have to check after draw:drawstart
, but before draw:created
, if isMarkerInsidePolygon(marker, polygon)
returns true or false.
If it returns false, I want to prevent setting the marker, but still keep the drawing mode active. Is there a posibility to prevent the setting of a marker in leaflet.draw?
There is a similar question asked by Ben, but no exactly the same case:
Leaflet draw: prevent drawing through a custom overlay