Closed superrache closed 3 years ago
Yes, you can do this by overriding the onFeatureAdd method of the PolylineEditor class if you only want to effect polylines. You can change the startof the index.html example script so that it starts like:
<script type="text/javascript">
var startPoint = [43.1249, 1.254];
const MyPolylineEditor = L.Editable.PolylineEditor.extend({
// Override to disable path dragging
onFeatureAdd: function () {
this.tools.editLayer.addLayer(this.editLayer);
if (this.feature.dragging) this.feature.dragging.disable();
},
});
var map = L.map('map', {
editable: true,
editOptions: {
polylineEditorClass: MyPolylineEditor,
}}).setView(startPoint, 16),
That's working great. Thanks a lot. Maybe this could become a parameter of Leaflet.Editable..
I use Leaflet.Editable on polylines and I would like to disable the line dragging feature and only keep point adding, removing and dragging. Is it possible?