From 17b649383299b6853e4d2b19c71e24bea5b8dd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 3 May 2024 23:18:02 +0200 Subject: [PATCH] add id to event screen updated. --- src/component/internal/messages.ts | 6 +++--- src/component/types/messages.ts | 8 +++----- src/page/main.vue | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/component/internal/messages.ts b/src/component/internal/messages.ts index afb56bf0..5cf4b873 100644 --- a/src/component/internal/messages.ts +++ b/src/component/internal/messages.ts @@ -36,7 +36,7 @@ export interface NekoEvents { // room events ['room.control.host']: (hasHost: boolean, hostID?: string) => void - ['room.screen.updated']: (width: number, height: number, rate: number) => void + ['room.screen.updated']: (width: number, height: number, rate: number, id?: string) => void ['room.clipboard.updated']: (text: string) => void ['room.broadcast.status']: (isActive: boolean, url?: string) => void @@ -278,10 +278,10 @@ export class NekoMessages extends EventEmitter { // Screen Events ///////////////////////////// - protected [EVENT.SCREEN_UPDATED]({ width, height, rate }: message.ScreenSize) { + protected [EVENT.SCREEN_UPDATED]({ width, height, rate, id }: message.ScreenSizeUpdate) { this._localLog.debug(`EVENT.SCREEN_UPDATED`) this._state.screen.size = { width, height, rate } // TODO: Vue.Set - this.emit('room.screen.updated', width, height, rate) + this.emit('room.screen.updated', width, height, rate, id) } ///////////////////////////// diff --git a/src/component/types/messages.ts b/src/component/types/messages.ts index 91b9ef13..87c3834a 100644 --- a/src/component/types/messages.ts +++ b/src/component/types/messages.ts @@ -1,5 +1,5 @@ import type { ICEServer } from '../internal/webrtc' -import type { Settings } from './state' +import type { Settings, ScreenSize } from './state' import type { PeerRequest, PeerVideo, PeerAudio } from './webrtc' ///////////////////////////// @@ -141,10 +141,8 @@ export interface ControlTouch extends Partial { // Screen ///////////////////////////// -export interface ScreenSize { - width: number - height: number - rate: number +export interface ScreenSizeUpdate extends ScreenSize { + id?: string } ///////////////////////////// diff --git a/src/page/main.vue b/src/page/main.vue index 8fe063a1..36a09b85 100644 --- a/src/page/main.vue +++ b/src/page/main.vue @@ -496,8 +496,8 @@ onMounted(() => { neko.value!.events.on('room.control.host', (hasHost: boolean, hostID?: string) => { console.log('room.control.host', hasHost, hostID) }) - neko.value!.events.on('room.screen.updated', (width: number, height: number, rate: number) => { - console.log('room.screen.updated', width, height, rate) + neko.value!.events.on('room.screen.updated', (width: number, height: number, rate: number, id: string) => { + console.log('room.screen.updated', width, height, rate, 'by', id) }) neko.value!.events.on('room.clipboard.updated', (text: string) => { console.log('room.clipboard.updated', text)