mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
synchronize keyboard modifiers with participant.
This commit is contained in:
parent
91c465eeca
commit
49d6174953
@ -16,6 +16,7 @@
|
||||
:implicitControl="state.control.implicit_hosting && state.members[state.member_id].profile.can_host"
|
||||
@implicit-control-request="websocket.send('control/request')"
|
||||
@implicit-control-release="websocket.send('control/release')"
|
||||
@update-kbd-modifiers="websocket.send('keyboard/modifiers', $event)"
|
||||
@drop-files="uploadDrop($event)"
|
||||
/>
|
||||
</div>
|
||||
|
@ -205,13 +205,8 @@
|
||||
this._overlay.focus()
|
||||
this.focused = true
|
||||
|
||||
if (!this.isControling) {
|
||||
// TODO: Refactor
|
||||
//syncKeyboardModifierState({
|
||||
// capsLock: e.getModifierState('CapsLock'),
|
||||
// numLock: e.getModifierState('NumLock'),
|
||||
// scrollLock: e.getModifierState('ScrollLock'),
|
||||
//})
|
||||
if (this.isControling) {
|
||||
this.updateKbdModifiers(e)
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,12 +217,11 @@
|
||||
if (this.isControling) {
|
||||
this.keyboard.reset()
|
||||
|
||||
// TODO: Refactor
|
||||
//setKeyboardModifierState({
|
||||
// capsLock: e.getModifierState('CapsLock'),
|
||||
// numLock: e.getModifierState('NumLock'),
|
||||
// scrollLock: e.getModifierState('ScrollLock'),
|
||||
//})
|
||||
// save current kbd modifiers state
|
||||
Vue.set(this, 'kbdModifiers', {
|
||||
capslock: e.getModifierState('CapsLock'),
|
||||
numlock: e.getModifierState('NumLock'),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,6 +249,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// keyboard modifiers
|
||||
//
|
||||
|
||||
private kbdModifiers: { capslock: boolean; numlock: boolean } | null = null
|
||||
|
||||
updateKbdModifiers(e: MouseEvent) {
|
||||
const capslock = e.getModifierState('CapsLock')
|
||||
const numlock = e.getModifierState('NumLock')
|
||||
|
||||
if (
|
||||
this.kbdModifiers === null ||
|
||||
this.kbdModifiers.capslock !== capslock ||
|
||||
this.kbdModifiers.numlock !== numlock
|
||||
) {
|
||||
this.$emit('update-kbd-modifiers', { capslock, numlock })
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// canvas
|
||||
//
|
||||
@ -336,7 +349,10 @@
|
||||
|
||||
@Watch('isControling')
|
||||
onControlChange(isControling: boolean) {
|
||||
Vue.set(this, 'kbdModifiers', null)
|
||||
|
||||
if (isControling && this.reqMouseDown) {
|
||||
this.updateKbdModifiers(this.reqMouseDown)
|
||||
this.setMousePos(this.reqMouseDown)
|
||||
this.webrtc.send('mousedown', { key: this.reqMouseDown.button + 1 })
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user