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