fix resizing
This commit is contained in:
parent
67ef2abb24
commit
92ec433539
@ -18,17 +18,20 @@ export function getAppView() {
|
||||
}
|
||||
|
||||
function resizeAppView() {
|
||||
if (!mainWindow || !appView) {
|
||||
return;
|
||||
}
|
||||
// TODO: workaround: set timeout is needed as mainWindow.getBounds() needs some time to update
|
||||
setTimeout(() => {
|
||||
if (!mainWindow || !appView) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { width, height } = mainWindow.getBounds();
|
||||
const { width, height } = mainWindow.getBounds();
|
||||
|
||||
appView.setBounds({
|
||||
x: sidebarWidth,
|
||||
y: 0,
|
||||
width: width - sidebarWidth,
|
||||
height: height,
|
||||
appView.setBounds({
|
||||
x: sidebarWidth,
|
||||
y: 0,
|
||||
width: width - sidebarWidth,
|
||||
height: height,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -92,16 +95,7 @@ export async function createWindow() {
|
||||
});
|
||||
resizeAppView();
|
||||
appView.setAutoResize({ width: true, height: true });
|
||||
|
||||
// TODO: workaround to fix appView resizing when window is resized
|
||||
mainWindow.on("maximize", resizeAppView);
|
||||
mainWindow.on("unmaximize", resizeAppView);
|
||||
mainWindow.on("minimize", resizeAppView);
|
||||
mainWindow.on("restore", resizeAppView);
|
||||
mainWindow.on("resize", resizeAppView);
|
||||
mainWindow.on("show", resizeAppView);
|
||||
mainWindow.on("enter-full-screen", resizeAppView);
|
||||
mainWindow.on("leave-full-screen", resizeAppView);
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
mainWindow?.show();
|
||||
|
Loading…
Reference in New Issue
Block a user