From 54ba4598b92d13611dbea2ea2f634d2bf2c9be59 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Wed, 3 Nov 2021 13:58:32 +0530 Subject: [PATCH] SDA-3422 - Workaround for the main view container height resize issue (#1289) --- src/app/window-utils.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/app/window-utils.ts b/src/app/window-utils.ts index 7eaf7dda..eae4f96a 100644 --- a/src/app/window-utils.ts +++ b/src/app/window-utils.ts @@ -1179,6 +1179,27 @@ export const loadBrowserViews = async ( height: false, }); + // Workaround to fix the auto resize of the main view container height + mainWindow.on('resize', () => { + if ( + !mainView || + mainView.webContents.isDestroyed() || + !mainWindow || + !windowExists(mainWindow) + ) { + return; + } + const bounds = mainView.getBounds(); + const [, height] = mainWindow.getSize(); + mainView.setBounds({ + ...bounds, + ...{ + y: mainWindow.isFullScreen() ? 0 : TITLE_BAR_HEIGHT, + height: mainWindow.isFullScreen() ? height : height - TITLE_BAR_HEIGHT, + }, + }); + }); + windowHandler.setMainView(mainView); windowHandler.setTitleBarView(mainView);