diff --git a/js/index.js b/js/index.js index 14432d2..4cc28eb 100644 --- a/js/index.js +++ b/js/index.js @@ -84,7 +84,7 @@ var deletePointButton = L.easyButton( '', function() { - routing.removeWaypoint(routing.getLast(), function(err, data) {}); + routing.deleteLastPoint(); }, i18next.t('map.delete-last-point') ); diff --git a/js/plugin/Routing.js b/js/plugin/Routing.js index 3675887..38005f4 100644 --- a/js/plugin/Routing.js +++ b/js/plugin/Routing.js @@ -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); diff --git a/locales/en.json b/locales/en.json index 6b3db7b..c1aceca 100644 --- a/locales/en.json +++ b/locales/en.json @@ -82,7 +82,7 @@ "clear-route": "Clear route data", "copyright": "Copyright", "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-pois": "Delete all points of interest", "delete-route": "Delete route",