Merge pull request #75 from m1k1o/mouseup_after_blur
Missing mouseup after blur
This commit is contained in:
commit
40a9819253
@ -161,6 +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 = {}
|
||||||
|
|
||||||
get admin() {
|
get admin() {
|
||||||
return this.$accessor.user.admin
|
return this.$accessor.user.admin
|
||||||
@ -333,12 +334,14 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
document.addEventListener('focusin', this.onFocus.bind(this))
|
document.addEventListener('focusin', this.onFocus.bind(this))
|
||||||
|
document.addEventListener('focusout', this.onBlur.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.observer.disconnect()
|
this.observer.disconnect()
|
||||||
this.$accessor.video.setPlayable(false)
|
this.$accessor.video.setPlayable(false)
|
||||||
document.removeEventListener('focusin', this.onFocus.bind(this))
|
document.removeEventListener('focusin', this.onFocus.bind(this))
|
||||||
|
document.removeEventListener('focusout', this.onBlur.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
play() {
|
play() {
|
||||||
@ -401,6 +404,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBlur() {
|
||||||
|
if (!this.focused || !this.hosting || this.locked) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let keys = Object.keys(this.activeKeys)
|
||||||
|
for(let key of keys) {
|
||||||
|
this.$client.sendData('keyup', { key })
|
||||||
|
delete this.activeKeys[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMousePos(e: MouseEvent) {
|
onMousePos(e: MouseEvent) {
|
||||||
const { w, h } = this.$accessor.video.resolution
|
const { w, h } = this.$accessor.video.resolution
|
||||||
const rect = this._overlay.getBoundingClientRect()
|
const rect = this._overlay.getBoundingClientRect()
|
||||||
@ -486,7 +501,9 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$client.sendData('keydown', { key: this.getCode(e) })
|
let key = this.getCode(e)
|
||||||
|
this.$client.sendData('keydown', { key })
|
||||||
|
this.activeKeys[key] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyUp(e: KeyboardEvent) {
|
onKeyUp(e: KeyboardEvent) {
|
||||||
@ -494,7 +511,9 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$client.sendData('keyup', { key: this.getCode(e) })
|
let key = this.getCode(e)
|
||||||
|
this.$client.sendData('keyup', { key })
|
||||||
|
delete this.activeKeys[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
onResise() {
|
onResise() {
|
||||||
|
Reference in New Issue
Block a user