From 3d8d8eb19924be2e988fbb788fab748e0305558c Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 28 Jan 2026 02:44:38 +0100 Subject: [PATCH] broadcast scaling parameters on ar change --- src/ext/module/EventBus.ts | 9 +++++---- src/ext/module/uwui/UI.ts | 8 ++++++++ src/ext/module/video-transform/Resizer.ts | 8 +++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/ext/module/EventBus.ts b/src/ext/module/EventBus.ts index d7b007a..4c6d1e8 100644 --- a/src/ext/module/EventBus.ts +++ b/src/ext/module/EventBus.ts @@ -107,10 +107,6 @@ export default class EventBus { eventBusCommand.function(commandData, context); } } - if (context.commandId) { - const i = this.lastExecutedCommandIndex++ % this.lastExecutedCommandIds.length; - this.lastExecutedCommandIds[i] = context.commandId; - } // preventing messages from flowing back to their original senders is // CommsServer's job. EventBus does not have enough data for this decision. @@ -119,6 +115,11 @@ export default class EventBus { if (!context.commandId) { context.commandId = crypto.randomUUID(); } + if (context.commandId) { + const i = this.lastExecutedCommandIndex++ % this.lastExecutedCommandIds.length; + this.lastExecutedCommandIds[i] = context.commandId; + } + if ( this.comms && context?.origin !== CommsOrigin.Server diff --git a/src/ext/module/uwui/UI.ts b/src/ext/module/uwui/UI.ts index 70028f8..1dae4eb 100644 --- a/src/ext/module/uwui/UI.ts +++ b/src/ext/module/uwui/UI.ts @@ -19,6 +19,8 @@ import { UwuiWindow } from './UwuiWindow'; import { createApp } from 'vue'; import SettingsWindowContent from '@components/SettingsWindowContent.vue'; +import { Ar } from '@src/common/interfaces/ArInterface'; +import { Stretch } from '@src/common/interfaces/StretchInterface'; // import jsonEditorCSS from 'vanilla-jsoneditor/themes/jse-theme-dark.css?inline' if (process.env.CHANNEL !== 'stable'){ @@ -93,6 +95,12 @@ class UI { function: (commandData, context) => { this.createSettingsWindow(commandData?.initialState); } + }, + + 'broadcast-scaling-params': { + function: (commandData: {effectiveZoom: {x: number, y: number}, lastAr: Ar, stretch: Stretch}, context) => { + console.warn('got scaling params:', commandData) + } } }); } diff --git a/src/ext/module/video-transform/Resizer.ts b/src/ext/module/video-transform/Resizer.ts index ccf9ff0..c0bc671 100644 --- a/src/ext/module/video-transform/Resizer.ts +++ b/src/ext/module/video-transform/Resizer.ts @@ -495,8 +495,14 @@ class Resizer { try { const translate = this.computeOffsets(stretchFactors, options?.ar); this.applyCss(stretchFactors, translate); + + this.eventBus.send('broadcast-scaling-params', { + effectiveZoom: {x: stretchFactors.xFactor, y: stretchFactors.yFactor}, + lastAr: this.lastAr, + stretch: this.stretcher.stretch + }); } catch (e) { - this.logger.warn('setAr', 'error while applying CSS:', e); + this.logger.warn('applyScaling', 'error while applying CSS:', e); // don't apply CSS if there's an error } }