🎨 Improve the window size settings after application restarts https://github.com/siyuan-note/siyuan/issues/13732

This commit is contained in:
Daniel 2025-01-06 21:18:45 +08:00
parent 5822519f06
commit 7ce19306ac
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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);
}