From f66c31c771d31678472dde87712c7109532c930f Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 18 Sep 2018 09:20:06 +0900 Subject: [PATCH] Improve usability & refactoring --- src/client/app/common/keycode.ts | 7 +--- .../views/components/reaction-picker.vue | 34 ++++++++----------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/client/app/common/keycode.ts b/src/client/app/common/keycode.ts index 0324a5389..55043ad76 100644 --- a/src/client/app/common/keycode.ts +++ b/src/client/app/common/keycode.ts @@ -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; -} diff --git a/src/client/app/common/views/components/reaction-picker.vue b/src/client/app/common/views/components/reaction-picker.vue index 4e27fb36e..f415e89d0 100644 --- a/src/client/app/common/views/components/reaction-picker.vue +++ b/src/client/app/common/views/components/reaction-picker.vue @@ -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; + } } },