broadcast scaling parameters on ar change

This commit is contained in:
Tamius Han 2026-01-28 02:44:38 +01:00
parent a0d599ce2f
commit 3d8d8eb199
3 changed files with 20 additions and 5 deletions

View File

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

View File

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

View File

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