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
|
|
@ -84,7 +84,7 @@
|
||||||
var deletePointButton = L.easyButton(
|
var deletePointButton = L.easyButton(
|
||||||
'<span><i class="fa fa-caret-left"></i><i class="fa fa-map-marker" style="margin-left: 1px; color: gray;"></i></span>',
|
'<span><i class="fa fa-caret-left"></i><i class="fa fa-map-marker" style="margin-left: 1px; color: gray;"></i></span>',
|
||||||
function() {
|
function() {
|
||||||
routing.removeWaypoint(routing.getLast(), function(err, data) {});
|
routing.deleteLastPoint();
|
||||||
},
|
},
|
||||||
i18next.t('map.delete-last-point')
|
i18next.t('map.delete-last-point')
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ BR.Routing = L.Routing.extend({
|
||||||
enable: 68, // char code for 'd'
|
enable: 68, // char code for 'd'
|
||||||
disable: 27 // char code for 'ESC'
|
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();
|
this._draw.enable();
|
||||||
} else if (e.keyCode === this.options.shortcut.reverse) {
|
} else if (e.keyCode === this.options.shortcut.reverse) {
|
||||||
this.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);
|
this.setWaypoints(waypoints);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
deleteLastPoint: function() {
|
||||||
|
this.removeWaypoint(this.getLast(), function(err, data) {});
|
||||||
|
},
|
||||||
|
|
||||||
_removeDistanceMarkers: function() {
|
_removeDistanceMarkers: function() {
|
||||||
if (this._map && this._distanceMarkers) {
|
if (this._map && this._distanceMarkers) {
|
||||||
this._map.removeLayer(this._distanceMarkers);
|
this._map.removeLayer(this._distanceMarkers);
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
"clear-route": "Clear route data",
|
"clear-route": "Clear route data",
|
||||||
"copyright": "Copyright",
|
"copyright": "Copyright",
|
||||||
"cycling": "Cycling",
|
"cycling": "Cycling",
|
||||||
"delete-last-point": "Delete last point",
|
"delete-last-point": "Delete last point (Z key)",
|
||||||
"delete-nogo-areas": "Delete all no-go areas",
|
"delete-nogo-areas": "Delete all no-go areas",
|
||||||
"delete-pois": "Delete all points of interest",
|
"delete-pois": "Delete all points of interest",
|
||||||
"delete-route": "Delete route",
|
"delete-route": "Delete route",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue