diff --git a/public/assets/desktop/desktop.js b/public/assets/desktop/desktop.js index 74542115..7c62ec72 100644 --- a/public/assets/desktop/desktop.js +++ b/public/assets/desktop/desktop.js @@ -977,13 +977,17 @@ if (payloadNode) { }; const clampWindowLayout = (record) => { - const maxWidth = Math.max(320, window.innerWidth - 48); - const maxHeight = Math.max(220, window.innerHeight - bottomDesktopInset - 24); + const minX = 0; + const minY = maximizeOverSystemBar ? 0 : topDesktopInset; + const maxWidth = Math.max(320, window.innerWidth - minX - sideDesktopInset); record.layout.width = Math.max(320, Math.min(record.layout.width, maxWidth)); + record.layout.x = Math.max(minX, Math.min(record.layout.x, window.innerWidth - record.layout.width)); + record.layout.y = Math.max(minY, Math.min(record.layout.y, window.innerHeight - bottomDesktopInset - 220)); + + const maxHeight = Math.max(220, window.innerHeight - bottomDesktopInset - record.layout.y); record.layout.height = Math.max(220, Math.min(record.layout.height, maxHeight)); - record.layout.x = Math.max(0, Math.min(record.layout.x, window.innerWidth - record.layout.width)); - record.layout.y = Math.max(0, Math.min(record.layout.y, window.innerHeight - bottomDesktopInset - record.layout.height)); + record.layout.y = Math.max(minY, Math.min(record.layout.y, window.innerHeight - bottomDesktopInset - record.layout.height)); }; const toggleMinimize = (windowId) => {