MattY
MattY

Reputation: 45

Leaflet.draw delete last point

I'm trying to create a set of buttons to replace the default L.Control.Draw buttons (only for a polyline, in my case). Using this answer

I have been able to replicate Draw, Edit, Delete and their associated 'Cancel' and 'Save' buttons. What I cannot figure out is how to replicate the 'Delete last point' function for the Draw button.

Upvotes: 1

Views: 2251

Answers (1)

iH8
iH8

Reputation: 28638

Call the deleteLastVertex method on your draw instance:

var drawPolyline = new L.Draw.Polyline(map, drawControl.options.polyline).enable();

drawPolyline.deleteLastVertex();

Upvotes: 3

Related Questions