Open parky128 opened 6 years ago
Hi @parky128, is possible.
use event: editable:vertex:dragstart and dragging.disable,
See sample to prevent drag first and last point of line:
map.on('editable:vertex:dragstart', function (e) {
var listLatLngs = e.vertex.latlngs;
var firstLatLng = listLatLngs[0];
var lastLatLng = listLatLngs[listLatLngs.length-1];
var currentLatLng = e.vertex.latlng;
if ((currentLatLng.lat == firstLatLng.lat && currentLatLng.lng == firstLatLng.lng) ||
(currentLatLng.lat == lastLatLng.lat && currentLatLng.lng == lastLatLng.lng))
{
e.vertex.dragging.disable();
}
});
Hope this helps. have a nice day. Fabricio
When editing a polyline, is it possible to prevent the user dragging certain points along the line? In my case I wish to prevent the user moving the start and end points. I know I can hook onto the drag start event and figure out whether the point is at the start or end of the line being edited, but I have been unable to cancel the drag event altogether. Is there a way?