From c5c9710a306e3d49c6ca170a962da2d0627d6bab Mon Sep 17 00:00:00 2001 From: Ovgodd Date: Wed, 7 Oct 2026 16:01:55 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=E2=99=BB=EF=B8=8F(frontend)=20add=20a?= =?UTF-8?q?uxiliary=20window=20helpers=20and=20zoom=20DOM=20resync=20#1695?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/utils/auxiliaryWindow.ts | 28 +++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/utils/auxiliaryWindow.ts b/src/frontend/src/utils/auxiliaryWindow.ts index d3525413a..8ef3c9c15 100644 --- a/src/frontend/src/utils/auxiliaryWindow.ts +++ b/src/frontend/src/utils/auxiliaryWindow.ts @@ -62,26 +62,40 @@ export const initializeAuxiliaryWindow = ( return ensureAuxiliaryRoot(target) } -// Match the shared screen size, but keep the window on one display. +const MIN_WIDTH = 320 +const MIN_HEIGHT = 240 +const FALLBACK_WIDTH = 1280 +const FALLBACK_HEIGHT = 720 +// Leaves room for the browser's title bar: window.open sizes the content. +const SCREEN_FRACTION = 0.9 + +// Sized to the share, on the meeting's screen. The user moves it from there. +// A very narrow share hits the minimum and gets bars, not a stretched picture. export const getAuxiliaryWindowSize = ( video?: Pick | null ) => { - const maxWidth = Math.max(320, Math.round(window.screen.availWidth * 0.9)) - const maxHeight = Math.max(240, Math.round(window.screen.availHeight * 0.9)) + const maxWidth = Math.max( + MIN_WIDTH, + Math.round(window.screen.availWidth * SCREEN_FRACTION) + ) + const maxHeight = Math.max( + MIN_HEIGHT, + Math.round(window.screen.availHeight * SCREEN_FRACTION) + ) const videoWidth = video?.videoWidth ?? 0 const videoHeight = video?.videoHeight ?? 0 if (videoWidth > 0 && videoHeight > 0) { const scale = Math.min(maxWidth / videoWidth, maxHeight / videoHeight, 1) return { - width: Math.max(320, Math.round(videoWidth * scale)), - height: Math.max(240, Math.round(videoHeight * scale)), + width: Math.max(MIN_WIDTH, Math.round(videoWidth * scale)), + height: Math.max(MIN_HEIGHT, Math.round(videoHeight * scale)), } } return { - width: Math.min(1280, maxWidth), - height: Math.min(720, maxHeight), + width: Math.min(FALLBACK_WIDTH, maxWidth), + height: Math.min(FALLBACK_HEIGHT, maxHeight), } }