javascriptleafletleaflet.draw

Disable leaflet-draw "delete" button


How can I disable/remove the delete button in the leaflet-draw edit toolbar? The "edit" button should remain enabled.


Solution

  • Regarding to the docs in chapter Disabeling a Toolbar Item you can do the following:

        map.addControl(new L.Control.Draw({
            edit: { 
                    featureGroup: drawnItems,
                    remove: false 
                  }
        }));
    

    This adds a new Control bar without the delete Button, but the edit button will remain