diff --git a/src/component/internal/control.ts b/src/component/internal/control.ts index 775e6cda..8b6f1d7d 100644 --- a/src/component/internal/control.ts +++ b/src/component/internal/control.ts @@ -37,6 +37,14 @@ export class NekoControl extends EventEmitter { 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) { this._connection.websocket.send(EVENT.CONTROL_KEYPRESS, { keysym } as message.ControlKey) } diff --git a/src/component/types/events.ts b/src/component/types/events.ts index 7b42a551..414a8aad 100644 --- a/src/component/types/events.ts +++ b/src/component/types/events.ts @@ -23,8 +23,8 @@ export const CONTROL_HOST = 'control/host' export const CONTROL_RELEASE = 'control/release' export const CONTROL_REQUEST = 'control/request' // mouse -export const CONTROL_MOVE = 'control/move' // TODO: New. (fallback) -export const CONTROL_SCROLL = 'control/scroll' // TODO: New. (fallback) +export const CONTROL_MOVE = 'control/move' +export const CONTROL_SCROLL = 'control/scroll' // keyboard export const CONTROL_KEYPRESS = 'control/keypress' export const CONTROL_KEYDOWN = 'control/keydown' diff --git a/src/component/types/messages.ts b/src/component/types/messages.ts index 0d0d4b8c..ce3dc32a 100644 --- a/src/component/types/messages.ts +++ b/src/component/types/messages.ts @@ -108,14 +108,7 @@ export interface ControlHost { host_id: string | undefined } -// TODO: New. -export interface ControlMove { - x: number - y: number -} - -// TODO: New. -export interface ControlScroll { +export interface ControlPos { x: number y: number }