mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
implement move and scroll for websocket control.
This commit is contained in:
parent
f3850e022c
commit
3382126f40
@ -37,6 +37,14 @@ export class NekoControl extends EventEmitter<NekoControlEvents> {
|
|||||||
this._connection.websocket.send(EVENT.CONTROL_RELEASE)
|
this._connection.websocket.send(EVENT.CONTROL_RELEASE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public move(x: number, y: number) {
|
||||||
|
this._connection.websocket.send(EVENT.CONTROL_MOVE, { x, y } as message.ControlPos)
|
||||||
|
}
|
||||||
|
|
||||||
|
public scroll(x: number, y: number) {
|
||||||
|
this._connection.websocket.send(EVENT.CONTROL_SCROLL, { x, y } as message.ControlPos)
|
||||||
|
}
|
||||||
|
|
||||||
public keyPress(keysym: number) {
|
public keyPress(keysym: number) {
|
||||||
this._connection.websocket.send(EVENT.CONTROL_KEYPRESS, { keysym } as message.ControlKey)
|
this._connection.websocket.send(EVENT.CONTROL_KEYPRESS, { keysym } as message.ControlKey)
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ export const CONTROL_HOST = 'control/host'
|
|||||||
export const CONTROL_RELEASE = 'control/release'
|
export const CONTROL_RELEASE = 'control/release'
|
||||||
export const CONTROL_REQUEST = 'control/request'
|
export const CONTROL_REQUEST = 'control/request'
|
||||||
// mouse
|
// mouse
|
||||||
export const CONTROL_MOVE = 'control/move' // TODO: New. (fallback)
|
export const CONTROL_MOVE = 'control/move'
|
||||||
export const CONTROL_SCROLL = 'control/scroll' // TODO: New. (fallback)
|
export const CONTROL_SCROLL = 'control/scroll'
|
||||||
// keyboard
|
// keyboard
|
||||||
export const CONTROL_KEYPRESS = 'control/keypress'
|
export const CONTROL_KEYPRESS = 'control/keypress'
|
||||||
export const CONTROL_KEYDOWN = 'control/keydown'
|
export const CONTROL_KEYDOWN = 'control/keydown'
|
||||||
|
@ -108,14 +108,7 @@ export interface ControlHost {
|
|||||||
host_id: string | undefined
|
host_id: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: New.
|
export interface ControlPos {
|
||||||
export interface ControlMove {
|
|
||||||
x: number
|
|
||||||
y: number
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: New.
|
|
||||||
export interface ControlScroll {
|
|
||||||
x: number
|
x: number
|
||||||
y: number
|
y: number
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user