Работа над хоткеями

This commit is contained in:
Book Pauk
2020-03-18 20:20:06 +07:00
parent 00a8e4c2c5
commit 22e2c34da8
3 changed files with 17 additions and 14 deletions

View File

@@ -173,21 +173,21 @@ class LoaderPage extends Vue {
const input = this.$refs.input.$refs.input;
if (document.activeElement === input && event.type == 'keydown' && event.code == 'Enter') {
this.submitUrl();
}
if (event.type == 'keydown' && (event.code == 'F1' || (document.activeElement !== input && event.code == 'KeyH'))) {
this.$emit('help-toggle');
event.preventDefault();
event.stopPropagation();
return true;
}
if (event.type == 'keydown' && (document.activeElement !== input && event.code == 'KeyQ')) {
this.$emit('tool-bar-toggle');
event.preventDefault();
event.stopPropagation();
return true;
if (event.type == 'keydown' && document.activeElement !== input) {
const action = this.$root.readerActionByKeyEvent(event);
switch (action) {
case 'help':
this.$emit('help-toggle');
event.preventDefault();
event.stopPropagation();
return true;
}
}
return false;
}
}
//-----------------------------------------------------------------------------

View File

@@ -58,8 +58,11 @@ class SetPositionPage extends Vue {
}
keyHook(event) {
if (event.type == 'keydown' && (event.code == 'Escape' || event.code == 'KeyP')) {
this.close();
if (event.type == 'keydown') {
const action = this.$root.readerActionByKeyEvent(event);
if (event.code == 'Escape' || action == 'setPosition') {
this.close();
}
}
return true;
}