Merge pull request #79 from barzamin/fix-78

components/video.vue: fix keyup-on-blur code
This commit is contained in:
Nurdism 2020-04-15 16:14:19 -04:00 committed by GitHub
commit bd1614b320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,7 @@
private observer = new ResizeObserver(this.onResise.bind(this)) private observer = new ResizeObserver(this.onResise.bind(this))
private focused = false private focused = false
private fullscreen = false private fullscreen = false
private activeKeys: any = {} private activeKeys: Set<number> = new Set()
get admin() { get admin() {
return this.$accessor.user.admin return this.$accessor.user.admin
@ -409,10 +409,9 @@
return return
} }
let keys = Object.keys(this.activeKeys) for (let key of this.activeKeys) {
for(let key of keys) {
this.$client.sendData('keyup', { key }) this.$client.sendData('keyup', { key })
delete this.activeKeys[key] this.activeKeys.delete(key)
} }
} }
@ -503,7 +502,7 @@
let key = this.getCode(e) let key = this.getCode(e)
this.$client.sendData('keydown', { key }) this.$client.sendData('keydown', { key })
this.activeKeys[key] = true this.activeKeys.add(key)
} }
onKeyUp(e: KeyboardEvent) { onKeyUp(e: KeyboardEvent) {
@ -513,7 +512,7 @@
let key = this.getCode(e) let key = this.getCode(e)
this.$client.sendData('keyup', { key }) this.$client.sendData('keyup', { key })
delete this.activeKeys[key] this.activeKeys.delete(key)
} }
onResise() { onResise() {