fix: Window gets stuck offscreen in some instances (#2303)

Improved offscreen detection logic, fixes th-ch#1894
This commit is contained in:
lawr
2024-08-01 18:27:01 +08:00
committed by GitHub
parent c1ad168c32
commit c8d516c40b

View File

@ -331,10 +331,10 @@ async function createMainWindow() {
const scaledY = windowY;
if (
scaledX + scaledWidth < display.bounds.x - 8 ||
scaledX - scaledWidth > display.bounds.x + display.bounds.width ||
scaledY < display.bounds.y - 8 ||
scaledY > display.bounds.y + display.bounds.height
scaledX + (scaledWidth / 2) < display.bounds.x - 8 || // Left
scaledX + (scaledWidth / 2) > display.bounds.x + display.bounds.width || // Right
scaledY < display.bounds.y - 8 || // Top
scaledY + (scaledHeight / 2) > display.bounds.y + display.bounds.height // Bottom
) {
// Window is offscreen
if (is.dev()) {