fix: update mainWindowDefaultSize to use primary display dimensions
- Changed mainWindowDefaultSize from static properties to a getter that retrieves the primary display's work area size, ensuring the main window adapts to different screen resolutions. - Adjusted logic for determining window dimensions to improve handling of window state and maximum size constraints.
This commit is contained in:
parent
4edae950c0
commit
3d089930fd
|
|
@ -22,9 +22,13 @@ import { loadDynamicRenderEntry } from "~/updater/hot-updater"
|
|||
const __dirname = fileURLToPath(new URL(".", import.meta.url))
|
||||
|
||||
class WindowManagerStatic {
|
||||
static readonly mainWindowDefaultSize = {
|
||||
height: 900,
|
||||
width: 1600,
|
||||
static get mainWindowDefaultSize() {
|
||||
const primaryDisplay = screen.getPrimaryDisplay()
|
||||
const { workAreaSize } = primaryDisplay
|
||||
return {
|
||||
height: workAreaSize.height,
|
||||
width: workAreaSize.width,
|
||||
}
|
||||
}
|
||||
|
||||
// Window configuration properties for better DX
|
||||
|
|
@ -346,8 +350,10 @@ class WindowManagerStatic {
|
|||
|
||||
const defaultSize = WindowManagerStatic.mainWindowDefaultSize
|
||||
|
||||
const width = Math.min(windowState?.width || defaultSize.width, maxWidth)
|
||||
const height = Math.min(windowState?.height || defaultSize.height, maxHeight)
|
||||
const width = windowState?.width ? Math.min(windowState.width, maxWidth) : defaultSize.width
|
||||
const height = windowState?.height
|
||||
? Math.min(windowState.height, maxHeight)
|
||||
: defaultSize.height
|
||||
|
||||
const ensureInBounds = (value: number, min: number, max: number): number => {
|
||||
return Math.max(min, Math.min(value, max))
|
||||
|
|
|
|||
Loading…
Reference in New Issue