Add shortcut to delete last point
Press 'Z' to undo adding the last point.
This commit is contained in:
parent
a852acbfce
commit
48f8fe3524
3 changed files with 10 additions and 3 deletions
|
|
@ -29,7 +29,8 @@ BR.Routing = L.Routing.extend({
|
|||
enable: 68, // char code for 'd'
|
||||
disable: 27 // char code for 'ESC'
|
||||
},
|
||||
reverse: 82 // char code for 'r'
|
||||
reverse: 82, // char code for 'r'
|
||||
deleteLastPoint: 90 // char code for 'z'
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -352,6 +353,8 @@ BR.Routing = L.Routing.extend({
|
|||
this._draw.enable();
|
||||
} else if (e.keyCode === this.options.shortcut.reverse) {
|
||||
this.reverse();
|
||||
} else if (e.keyCode === this.options.shortcut.deleteLastPoint) {
|
||||
this.deleteLastPoint();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -374,6 +377,10 @@ BR.Routing = L.Routing.extend({
|
|||
this.setWaypoints(waypoints);
|
||||
},
|
||||
|
||||
deleteLastPoint: function() {
|
||||
this.removeWaypoint(this.getLast(), function(err, data) {});
|
||||
},
|
||||
|
||||
_removeDistanceMarkers: function() {
|
||||
if (this._map && this._distanceMarkers) {
|
||||
this._map.removeLayer(this._distanceMarkers);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue