change keyboard shortcuts; update tooltips

- "Load Track as Route" is now triggered by pressing `Shift-O`
- "Load No-Go-Areas" is now triggered by pressing `Shift-N`
- tooltip for navbar link is updated an ready for translation
This commit is contained in:
Marcus Jaschen 2021-03-25 07:58:51 +01:00
parent bc26eb3042
commit d1285baa69
5 changed files with 32 additions and 17 deletions

View file

@ -78,12 +78,14 @@
aria-haspopup="true" aria-haspopup="true"
aria-expanded="false" aria-expanded="false"
data-i18n="[title]navbar.load.tooltip" data-i18n="[title]navbar.load.tooltip"
data-i18n-options="{ data-i18n-options='{
'tracksAction': '$t(navbar.load.tracks)', "tracksAction": "$t(navbar.load.tracks)",
'tracksKey': 'O', "tracksKey": "O",
'nogosAction': '$t(navbar.load.nogos)', "trackAsRouteAction": "$t(trackasroute.title)",
'nogosKey': '$t(keyboard.shift)+O' "trackAsRouteKey": "$t(keyboard.shift)+O",
}" "nogosAction": "$t(navbar.load.nogos)",
"nogosKey": "$t(keyboard.shift)+N"
}'
title="Load route" title="Load route"
> >
<span class="fa fa-lg fa-cloud-upload" aria-hidden="true"> </span> <span class="fa fa-lg fa-cloud-upload" aria-hidden="true"> </span>

View file

@ -5,6 +5,7 @@ BR.NogoAreas = L.Control.extend({
enable: 78, // char code for 'n' enable: 78, // char code for 'n'
disable: 27, // char code for 'ESC' disable: 27, // char code for 'ESC'
}, },
import: 78, // char code for 'n'; used in conjunction with 'shift'
}, },
}, },
@ -147,6 +148,13 @@ BR.NogoAreas = L.Control.extend({
if (!BR.Util.keyboardShortcutsAllowed(e)) { if (!BR.Util.keyboardShortcutsAllowed(e)) {
return; return;
} }
if (true === e.shiftKey && e.keyCode === this.options.shortcut.import) {
$('#loadNogos').modal('show');
return;
}
if (e.keyCode === this.options.shortcut.draw.disable && this.button.state() === BR.NogoAreas.STATE_CANCEL) { if (e.keyCode === this.options.shortcut.draw.disable && this.button.state() === BR.NogoAreas.STATE_CANCEL) {
this.stopDrawing(this.button); this.stopDrawing(this.button);
} else if ( } else if (

View file

@ -16,7 +16,7 @@ BR.routeLoader = function (map, layersControl, routing, pois) {
isTestMode: false, isTestMode: false,
simplifyLastKnownGood: 0.001, simplifyLastKnownGood: 0.001,
shortcut: { shortcut: {
open: 82, // char code for 'r' open: 79, // char code for 'O'; used in conjunction with 'shift'
}, },
}, },
@ -93,7 +93,7 @@ BR.routeLoader = function (map, layersControl, routing, pois) {
isTestMode: false, isTestMode: false,
simplifyLastKnownGood: 0.001, simplifyLastKnownGood: 0.001,
shortcut: { shortcut: {
open: 82, // char code for 'r' open: 79, // char code for 'O'; used in conjunction with 'shift'
}, },
}; };
}, },
@ -391,7 +391,11 @@ BR.routeLoader = function (map, layersControl, routing, pois) {
}, },
keydownListener: function (e) { keydownListener: function (e) {
if (BR.Util.keyboardShortcutsAllowed(e) && e.keyCode === this._options.shortcut.open) { if (
BR.Util.keyboardShortcutsAllowed(e) &&
e.keyCode === this._options.shortcut.open &&
true === e.shiftKey
) {
$('#navbarLoadEditTracks').click(); $('#navbarLoadEditTracks').click();
} }
}, },

View file

@ -61,12 +61,12 @@ BR.tracksLoader = function (map, layersControl, routing, pois) {
}, },
_keydownListener: function (e) { _keydownListener: function (e) {
if (BR.Util.keyboardShortcutsAllowed(e) && e.keyCode === this.options.shortcut.open) { if (
if (e.shiftKey) { BR.Util.keyboardShortcutsAllowed(e) &&
$('#loadNogos').modal('show'); e.keyCode === this.options.shortcut.open &&
} else { false === e.shiftKey
$('#navbarLoadTracks')[0].click(); ) {
} $('#navbarLoadTracks')[0].click();
} }
}, },
}); });

View file

@ -174,8 +174,9 @@
"load": { "load": {
"nogos": "Load no-go areas", "nogos": "Load no-go areas",
"title": "Load", "title": "Load",
"tooltip": "{{tracksAction}} ({{tracksKey}} key)\n{{nogosAction}} ({{nogosKey}})", "tooltip": "{{tracksAction}} ({{tracksKey}} key)\n{{trackAsRouteAction}} ({{trackAsRouteKey}})\n{{nogosAction}} ({{nogosKey}})",
"tracks": "Load tracks" "tracks": "Load tracks",
"trackAsRoute": "Load Track as Route"
}, },
"profile": { "profile": {
"car-eco": "Car (economic)", "car-eco": "Car (economic)",