Improve usability & refactoring

This commit is contained in:
syuilo 2018-09-18 09:20:06 +09:00
parent 11817e1fc0
commit 89fe90321d
2 changed files with 15 additions and 26 deletions

View File

@ -124,15 +124,10 @@ for (let i = 97; i < 123; i++) {
// numbers
for (let i = 48; i < 58; i++) {
codes[i - 48] = i;
codes[i - 48] = [i, (i - 48) + 96];
}
// function keys
for (let i = 1; i < 13; i++) {
codes['f' + i] = i + 111;
}
// numpad keys
for (let i = 0; i < 10; i++) {
codes['numpad ' + i] = i + 96;
}

View File

@ -73,30 +73,20 @@ export default Vue.extend({
'enter': this.choose,
'space': this.choose,
'numpad plus': this.choose,
'1': () => this.react('like'),
'numpad 1': () => this.react('like'),
'2': () => this.react('love'),
'numpad 2': () => this.react('love'),
'3': () => this.react('laugh'),
'numpad 3': () => this.react('laugh'),
'4': () => this.react('hmm'),
'numpad 4': () => this.react('hmm'),
'5': () => this.react('surprise'),
'numpad 5': () => this.react('surprise'),
'6': () => this.react('congrats'),
'numpad 6': () => this.react('congrats'),
'7': () => this.react('angry'),
'numpad 7': () => this.react('angry'),
'8': () => this.react('confused'),
'numpad 8': () => this.react('confused'),
'9': () => this.react('rip'),
'numpad 9': () => this.react('rip'),
'0': () => this.react('pudding'),
'numpad 0': () => this.react('pudding'),
'up': this.focusUp,
'right': this.focusRight,
'down': this.focusDown,
'left': this.focusLeft,
'1': () => this.react('like'),
'2': () => this.react('love'),
'3': () => this.react('laugh'),
'4': () => this.react('hmm'),
'5': () => this.react('surprise'),
'6': () => this.react('congrats'),
'7': () => this.react('angry'),
'8': () => this.react('confused'),
'9': () => this.react('rip'),
'0': () => this.react('pudding'),
};
}
},
@ -104,6 +94,10 @@ export default Vue.extend({
watch: {
focus(i) {
this.$refs.buttons.childNodes[i].focus();
if (this.showFocus) {
this.title = this.$refs.buttons.childNodes[i].title;
}
}
},