The default behaviour of Leaflet Draw is to expect a single click to create vertices for lines and polygons. I find this impractical, especially for mobile devices. For example when I try to draw a polygon on mobile phone and start dragging/zooming the map while drawing, the touch input is automatically registered as a vertex input. Is there a way to modify Leaflet Draw to prevent this?
I am using Leaflet.draw 1.0.4 with leaflet 1.7.1
Code adding the Draw Control to the map:
// Leaflet Draw Control
var customIcon = L.icon({
iconUrl: 'marker.png',
iconSize: [30, 30],
iconAnchor: [15, 25],
popupAnchor: [-3, -76] });
var drawControl = new L.Control.Draw({
edit: {
featureGroup: drawnItems
},
draw: {
polygon: {
shapeOptions: {
color: '#94e50e',
opacity: 1
},
showArea: true,
metric: true
},
polyline: {
shapeOptions: {
color: '#94e50e',
opacity: 1
},
showLength: true,
metric: true
},
rectangle: false,
circle: false,
marker: {
icon: customIcon
},
circlemarker: false
} }); map.addControl(drawControl);