Add shortcut to export route
Press 'X' to trigger the export route dialog. Automatically populating the trackname field should work too.
This commit is contained in:
parent
6da520ed4d
commit
a420ad5c0b
3 changed files with 22 additions and 0 deletions
|
|
@ -1,6 +1,12 @@
|
|||
BR.Export = L.Class.extend({
|
||||
latLngs: [],
|
||||
|
||||
options: {
|
||||
shortcut: {
|
||||
export: 88 // char code for 'x'
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function(router, pois) {
|
||||
this.router = router;
|
||||
this.pois = pois;
|
||||
|
|
@ -20,6 +26,8 @@ BR.Export = L.Class.extend({
|
|||
this.exportButton.on('click', L.bind(this._generateTrackname, this));
|
||||
L.DomUtil.get('submitExport').onclick = L.bind(this._export, this);
|
||||
|
||||
L.DomEvent.addListener(document, 'keydown', this._keydownListener, this);
|
||||
|
||||
this.update([]);
|
||||
},
|
||||
|
||||
|
|
@ -116,6 +124,17 @@ BR.Export = L.Class.extend({
|
|||
}
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
_keydownListener: function(e) {
|
||||
if (
|
||||
BR.Util.keyboardShortcutsAllowed(e) &&
|
||||
e.keyCode === this.options.shortcut.export &&
|
||||
!this.exportButton.hasClass('disabled')
|
||||
) {
|
||||
this._generateTrackname();
|
||||
$('#export').modal('show');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue