fix: window maximized and fullscreen now don't conflict with each other (#872)
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
"core:window:allow-center",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
"core:window:allow-set-size",
|
||||
"core:window:allow-set-focus",
|
||||
"core:window:allow-is-maximized",
|
||||
|
||||
@@ -15,7 +15,14 @@ export const tauriHandleMinimize = async () => {
|
||||
};
|
||||
|
||||
export const tauriHandleToggleMaximize = async () => {
|
||||
getCurrentWindow().toggleMaximize();
|
||||
const currentWindow = getCurrentWindow();
|
||||
const isFullscreen = await currentWindow.isFullscreen();
|
||||
if (isFullscreen) {
|
||||
await currentWindow.setFullscreen(false);
|
||||
await currentWindow.unmaximize();
|
||||
} else {
|
||||
getCurrentWindow().toggleMaximize();
|
||||
}
|
||||
};
|
||||
|
||||
export const tauriHandleClose = async () => {
|
||||
@@ -34,8 +41,12 @@ export const tauriHandleOnCloseWindow = async (callback: () => void) => {
|
||||
export const tauriHandleToggleFullScreen = async () => {
|
||||
const currentWindow = getCurrentWindow();
|
||||
const isFullscreen = await currentWindow.isFullscreen();
|
||||
const newIsFullscreen = !isFullscreen;
|
||||
await currentWindow.setFullscreen(newIsFullscreen);
|
||||
const isMaximized = await currentWindow.isMaximized();
|
||||
if (isMaximized) {
|
||||
await currentWindow.unmaximize();
|
||||
} else {
|
||||
await currentWindow.setFullscreen(!isFullscreen);
|
||||
}
|
||||
};
|
||||
|
||||
export const tauriHandleSetAlwaysOnTop = async (isAlwaysOnTop: boolean) => {
|
||||
|
||||
Reference in New Issue
Block a user