From 7ce19306ac23df4bbe061873a136e05334105eab Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 6 Jan 2025 21:18:45 +0800 Subject: [PATCH] :art: Improve the window size settings after application restarts https://github.com/siyuan-note/siyuan/issues/13732 --- app/electron/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/electron/main.js b/app/electron/main.js index 83b0d1831..7d217a509 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -277,7 +277,9 @@ const initMainWindow = () => { let y = windowState.y; if (workArea) { // 窗口大于 workArea 时缩小会隐藏到左下角,这里使用最小值重置 - if (windowState.width > workArea.width || windowState.height > workArea.height) { // 重启后窗口大小恢复默认问题 https://github.com/siyuan-note/siyuan/issues/7755 + if (windowState.width > workArea.width + 32 || windowState.height > workArea.height + 32) { + // 重启后窗口大小恢复默认问题 https://github.com/siyuan-note/siyuan/issues/7755 https://github.com/siyuan-note/siyuan/issues/13732 + // 这里 +32 是因为在某种情况下窗口大小会比 workArea 大几个像素导致恢复默认,+32 可以避免这种特殊情况 windowState.width = Math.min(defaultWidth, workArea.width); windowState.height = Math.min(defaultHeight, workArea.height); }