SDA-3422 - Delay resizing window (#1308)

This commit is contained in:
Kiran Niranjan authored and GitHub committed 2021-12-30 14:22:54 +05:30
1 parent 9e4a51fcfc
commit f0c2a6bfe1
1 file changed
+21 -17
+21 -17
View File
@@ -1185,23 +1185,27 @@ export const loadBrowserViews = async (
// 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,
},
});
setTimeout(() => {
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,
},
});
}, 500);
});
windowHandler.setMainView(mainView);