mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
overlay send events over WS if not connected.
This commit is contained in:
parent
4b2c03b88d
commit
84708c77d2
@ -150,7 +150,12 @@
|
|||||||
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
||||||
if (isCtrlKey) ctrlKey = key
|
if (isCtrlKey) ctrlKey = key
|
||||||
|
|
||||||
this.webrtc.send('keydown', { key })
|
if (this.webrtc.connected) {
|
||||||
|
this.webrtc.send('keydown', { key })
|
||||||
|
} else {
|
||||||
|
this.control.keyDown(key)
|
||||||
|
}
|
||||||
|
|
||||||
return isCtrlKey
|
return isCtrlKey
|
||||||
}
|
}
|
||||||
this.keyboard.onkeyup = (key: number) => {
|
this.keyboard.onkeyup = (key: number) => {
|
||||||
@ -164,7 +169,11 @@
|
|||||||
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
||||||
if (isCtrlKey) ctrlKey = 0
|
if (isCtrlKey) ctrlKey = 0
|
||||||
|
|
||||||
this.webrtc.send('keyup', { key })
|
if (this.webrtc.connected) {
|
||||||
|
this.webrtc.send('keyup', { key })
|
||||||
|
} else {
|
||||||
|
this.control.keyUp(key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.keyboard.listenTo(this._textarea)
|
this.keyboard.listenTo(this._textarea)
|
||||||
|
|
||||||
@ -244,8 +253,6 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendMousePos(e)
|
|
||||||
|
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
const firstScroll = now - this.wheelDate > 250
|
const firstScroll = now - this.wheelDate > 250
|
||||||
|
|
||||||
@ -292,8 +299,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x != 0 || y != 0) {
|
// skip if not scrolled
|
||||||
|
if (x == 0 && y == 0) return
|
||||||
|
|
||||||
|
if (this.webrtc.connected) {
|
||||||
|
this.sendMousePos(e)
|
||||||
this.webrtc.send('wheel', { x, y })
|
this.webrtc.send('wheel', { x, y })
|
||||||
|
} else {
|
||||||
|
this.control.scroll(x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,8 +326,14 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendMousePos(e)
|
const key = e.button + 1
|
||||||
this.webrtc.send('mousedown', { key: e.button + 1 })
|
if (this.webrtc.connected) {
|
||||||
|
this.sendMousePos(e)
|
||||||
|
this.webrtc.send('mousedown', { key })
|
||||||
|
} else {
|
||||||
|
const { x, y } = this.getMousePos(e.clientX, e.clientY)
|
||||||
|
this.control.buttonDown(key, x, y)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseUp(e: MouseEvent) {
|
onMouseUp(e: MouseEvent) {
|
||||||
@ -323,8 +342,14 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendMousePos(e)
|
const key = e.button + 1
|
||||||
this.webrtc.send('mouseup', { key: e.button + 1 })
|
if (this.webrtc.connected) {
|
||||||
|
this.sendMousePos(e)
|
||||||
|
this.webrtc.send('mouseup', { key })
|
||||||
|
} else {
|
||||||
|
const { x, y } = this.getMousePos(e.clientX, e.clientY)
|
||||||
|
this.control.buttonUp(key, x, y)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseEnter(e: MouseEvent) {
|
onMouseEnter(e: MouseEvent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user