codejunkie
codejunkie

Reputation: 968

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.

Upvotes: 2

Views: 5373

Answers (2)

Mert Kahramantürk
Mert Kahramantürk

Reputation: 121

<EditControl
  position="topright"
  edit={{
    remove: false,
    edit: false
  }}
/>

Upvotes: 0

Manuel
Manuel

Reputation: 2542

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

Upvotes: 7

Related Questions