Эх сурвалжийг харах

Lock the window default and minimum size to 1100×720 so the layout cannot be shrunk below the designed dimensions.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 сар өмнө
parent
commit
32df6d54de

+ 2 - 2
gramora/Utilities/AppTheme.swift

@@ -3,8 +3,8 @@ import SwiftUI
 enum AppTheme {
     static let windowWidth: CGFloat = 1100
     static let windowHeight: CGFloat = 720
-    static let windowMinWidth: CGFloat = 900
-    static let windowMinHeight: CGFloat = 600
+    static let windowMinWidth: CGFloat = windowWidth
+    static let windowMinHeight: CGFloat = windowHeight
 
     static let sidebarWidth: CGFloat = 240
     static let contentPadding: CGFloat = 40

+ 9 - 2
gramora/Utilities/InitialWindowSizeModifier.swift

@@ -36,9 +36,16 @@ private struct WindowSizeAccessor: NSViewRepresentable {
         private var didConfigure = false
 
         func configure(window: NSWindow?, width: CGFloat, height: CGFloat) {
-            guard !didConfigure, let window else { return }
+            guard let window else { return }
+
+            let contentSize = NSSize(width: width, height: height)
+            let frameSize = window.frameRect(forContentRect: NSRect(origin: .zero, size: contentSize)).size
+            window.minSize = frameSize
+
+            guard !didConfigure else { return }
             didConfigure = true
-            window.setContentSize(NSSize(width: width, height: height))
+
+            window.setContentSize(contentSize)
             window.center()
         }
     }