Merge pull request #179 from bagage/54-add-reverse-button
Add reverse route / delete last point buttons
This commit is contained in:
commit
d799f94733
3 changed files with 30 additions and 4 deletions
25
js/index.js
25
js/index.js
|
|
@ -32,9 +32,10 @@
|
||||||
trackMessages,
|
trackMessages,
|
||||||
sidebar,
|
sidebar,
|
||||||
drawButton,
|
drawButton,
|
||||||
deleteButton,
|
deleteRouteButton,
|
||||||
drawToolbar,
|
drawToolbar,
|
||||||
urlHash,
|
urlHash,
|
||||||
|
reverseRoute,
|
||||||
saveWarningShown = false;
|
saveWarningShown = false;
|
||||||
|
|
||||||
// By default bootstrap-select use glyphicons
|
// By default bootstrap-select use glyphicons
|
||||||
|
|
@ -70,7 +71,23 @@
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteButton = L.easyButton(
|
reverseRouteButton = L.easyButton(
|
||||||
|
'fa-random',
|
||||||
|
function () {
|
||||||
|
routing.reverse();
|
||||||
|
},
|
||||||
|
i18next.t('map.reverse-route')
|
||||||
|
);
|
||||||
|
|
||||||
|
deletePointButton = L.easyButton(
|
||||||
|
'<span class="fa-stack fa-lg"><i class="fa fa-map-marker fa-align-left fa-stack-1x"></i><i class="fa fa-long-arrow-left fa-stack-1x"></i></span>',
|
||||||
|
function () {
|
||||||
|
routing.removeWaypoint(routing.getLast());
|
||||||
|
},
|
||||||
|
i18next.t('map.delete-last-point')
|
||||||
|
);
|
||||||
|
|
||||||
|
deleteRouteButton = L.easyButton(
|
||||||
'fa-trash-o',
|
'fa-trash-o',
|
||||||
function () {
|
function () {
|
||||||
bootbox.prompt({
|
bootbox.prompt({
|
||||||
|
|
@ -227,7 +244,7 @@
|
||||||
|
|
||||||
routing.addTo(map);
|
routing.addTo(map);
|
||||||
elevation.addBelow(map);
|
elevation.addBelow(map);
|
||||||
|
|
||||||
sidebar = BR.sidebar({
|
sidebar = BR.sidebar({
|
||||||
defaultTabId: BR.conf.transit ? 'tab_itinerary' : 'tab_profile',
|
defaultTabId: BR.conf.transit ? 'tab_itinerary' : 'tab_profile',
|
||||||
listeningTabs: {
|
listeningTabs: {
|
||||||
|
|
@ -240,7 +257,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
nogos.addTo(map);
|
nogos.addTo(map);
|
||||||
drawToolbar = L.easyBar([drawButton, nogos.getButton(), deleteButton]).addTo(map);
|
drawToolbar = L.easyBar([drawButton, reverseRouteButton, nogos.getButton(), deletePointButton, deleteRouteButton]).addTo(map);
|
||||||
nogos.preventRoutePointOnCreate(routing);
|
nogos.preventRoutePointOnCreate(routing);
|
||||||
|
|
||||||
if (BR.keys.strava) {
|
if (BR.keys.strava) {
|
||||||
|
|
|
||||||
|
|
@ -299,4 +299,11 @@ BR.Routing = L.Routing.extend({
|
||||||
,isDrawing: function () {
|
,isDrawing: function () {
|
||||||
return this._draw._enabled;
|
return this._draw._enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,reverse: function() {
|
||||||
|
var waypoints = this.getWaypoints();
|
||||||
|
waypoints.reverse();
|
||||||
|
this.clear();
|
||||||
|
this.setWaypoints(waypoints);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@
|
||||||
"clear-route": "Clear route",
|
"clear-route": "Clear route",
|
||||||
"copyright": "Copyright",
|
"copyright": "Copyright",
|
||||||
"cycling": "Cycling",
|
"cycling": "Cycling",
|
||||||
|
"delete-last-point": "Delete last point",
|
||||||
"delete-nogo-areas": " also delete all no-go areas",
|
"delete-nogo-areas": " also delete all no-go areas",
|
||||||
"delete-route": "Delete route?",
|
"delete-route": "Delete route?",
|
||||||
"draw-route-start": "Draw route (D key)",
|
"draw-route-start": "Draw route (D key)",
|
||||||
|
|
@ -93,6 +94,7 @@
|
||||||
},
|
},
|
||||||
"opacity-slider": "Set transparency of route track and markers",
|
"opacity-slider": "Set transparency of route track and markers",
|
||||||
"privacy": "Privacy",
|
"privacy": "Privacy",
|
||||||
|
"reverse-route": "Reverse route",
|
||||||
"strava-biking": "Show Strava biking segments",
|
"strava-biking": "Show Strava biking segments",
|
||||||
"strava-running": "Show Strava running segments",
|
"strava-running": "Show Strava running segments",
|
||||||
"zoomInTitle": "Zoom in",
|
"zoomInTitle": "Zoom in",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue