From 363fd11f63dee79ba34dede647fd0bbd189e4a80 Mon Sep 17 00:00:00 2001 From: claude-bot Date: Mon, 4 May 2026 15:36:14 +0900 Subject: [PATCH] Fix responsive scaling feedback loop --- app/assets/js/scripts/uicore.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/assets/js/scripts/uicore.js b/app/assets/js/scripts/uicore.js index 144dc56..fa6454d 100644 --- a/app/assets/js/scripts/uicore.js +++ b/app/assets/js/scripts/uicore.js @@ -39,6 +39,7 @@ const BASE_WINDOW_WIDTH = 1400 const BASE_WINDOW_HEIGHT = 860 let responsiveLayoutFrame = null +let lastAppliedZoomFactor = null function clamp(value, min, max){ return Math.min(Math.max(value, min), max) @@ -70,13 +71,18 @@ function syncLaunchDetailWidths(){ } function applyResponsiveLayout(){ + const currentWindow = remote.getCurrentWindow() + const contentBounds = currentWindow.getContentBounds() const scale = clamp( - Math.min(window.innerWidth / BASE_WINDOW_WIDTH, window.innerHeight / BASE_WINDOW_HEIGHT), + Math.min(contentBounds.width / BASE_WINDOW_WIDTH, contentBounds.height / BASE_WINDOW_HEIGHT), 0.72, 1.45 ) - webFrame.setZoomFactor(scale) + if(lastAppliedZoomFactor == null || Math.abs(lastAppliedZoomFactor - scale) > 0.001){ + lastAppliedZoomFactor = scale + webFrame.setZoomFactor(scale) + } document.documentElement.style.setProperty('--launcher-scale', scale.toFixed(3)) window.requestAnimationFrame(() => { @@ -94,9 +100,10 @@ function queueResponsiveLayout(){ }) } -window.addEventListener('resize', () => { - queueResponsiveLayout() -}) +const responsiveWindow = remote.getCurrentWindow() +responsiveWindow.on('resize', queueResponsiveLayout) +responsiveWindow.on('maximize', queueResponsiveLayout) +responsiveWindow.on('unmaximize', queueResponsiveLayout) // Initialize auto updates in production environments. let updateCheckListener