broadcast scaling parameters on ar change
This commit is contained in:
parent
a0d599ce2f
commit
3d8d8eb199
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user