implement move and scroll for websocket control.

This commit is contained in:
Miroslav Šedivý 2022-07-21 19:37:58 +02:00
parent f3850e022c
commit 3382126f40
3 changed files with 11 additions and 10 deletions

View File

@ -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)
} }

View File

@ -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'

View File

@ -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
} }