Add shortcuts to load tracks and no-go areas
Press 'O' or 'Shift+O' to open/load tracks or no-go areas respectively.
This commit is contained in:
parent
a420ad5c0b
commit
d106552ad3
3 changed files with 19 additions and 1 deletions
|
|
@ -78,6 +78,8 @@
|
||||||
id="navbarLoadDropdown"
|
id="navbarLoadDropdown"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
|
data-i18n="[title]navbar.load.tooltip"
|
||||||
|
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>
|
||||||
<span data-i18n="navbar.load.title">Load</span>
|
<span data-i18n="navbar.load.title">Load</span>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ BR.tracksLoader = function(map, layersControl, routing) {
|
||||||
},
|
},
|
||||||
addToMap: false,
|
addToMap: false,
|
||||||
// File size limit in kb (default: 1024) ?
|
// File size limit in kb (default: 1024) ?
|
||||||
fileSizeLimit: 1024
|
fileSizeLimit: 1024,
|
||||||
|
shortcut: {
|
||||||
|
open: 79 // char code for 'o'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_initContainer: function() {
|
_initContainer: function() {
|
||||||
|
|
@ -31,6 +34,8 @@ BR.tracksLoader = function(map, layersControl, routing) {
|
||||||
var fileInput;
|
var fileInput;
|
||||||
var container = L.DomUtil.get('navbarLoadTracksContainer');
|
var container = L.DomUtil.get('navbarLoadTracksContainer');
|
||||||
|
|
||||||
|
L.DomEvent.addListener(document, 'keydown', this._keydownListener, this);
|
||||||
|
|
||||||
// Create an invisible file input
|
// Create an invisible file input
|
||||||
fileInput = L.DomUtil.create('input', 'hidden', container);
|
fileInput = L.DomUtil.create('input', 'hidden', container);
|
||||||
fileInput.type = 'file';
|
fileInput.type = 'file';
|
||||||
|
|
@ -62,6 +67,16 @@ BR.tracksLoader = function(map, layersControl, routing) {
|
||||||
var dummy = L.DomUtil.create('div');
|
var dummy = L.DomUtil.create('div');
|
||||||
dummy.hidden = true;
|
dummy.hidden = true;
|
||||||
return dummy;
|
return dummy;
|
||||||
|
},
|
||||||
|
|
||||||
|
_keydownListener: function(e) {
|
||||||
|
if (BR.Util.keyboardShortcutsAllowed(e) && e.keyCode === this.options.shortcut.open) {
|
||||||
|
if (e.shiftKey) {
|
||||||
|
$('#loadNogos').modal('show');
|
||||||
|
} else {
|
||||||
|
$('#navbarLoadTracks')[0].click();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var tracksLoaderControl = new TracksLoader();
|
var tracksLoaderControl = new TracksLoader();
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@
|
||||||
"load": {
|
"load": {
|
||||||
"nogos": "No-go areas",
|
"nogos": "No-go areas",
|
||||||
"title": "Load",
|
"title": "Load",
|
||||||
|
"tooltip": "Load tracks (O key)\nLoad No-go areas (Shift+O)",
|
||||||
"tracks": "Tracks"
|
"tracks": "Tracks"
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue