Browse Source

Auto-fit window by default if no settings exist

Ruben 9 tháng trước cách đây
mục cha
commit
d7264eb514

+ 3 - 9
src/PicView.Avalonia/StartUp/StartUpHelper.cs

@@ -29,7 +29,7 @@ public static class StartUpHelper
 
         if (!settingsExists)
         {
-            InitializeWindowForNoSettings(window, vm);
+            InitializeWindowForNoSettings(vm);
         }
         else
         {
@@ -201,15 +201,9 @@ public static class StartUpHelper
         }
     }
 
-    private static void InitializeWindowForNoSettings(Window w, MainViewModel vm)
+    private static void InitializeWindowForNoSettings(MainViewModel vm)
     {
-        // Fixes incorrect window
-        w.Height = SizeDefaults.WindowMinSize;
-        w.Width = SizeDefaults.WindowMinSize;
-
-        WindowFunctions.CenterWindowOnScreen();
-        vm.CanResize = true;
-        vm.IsAutoFit = false;
+        HandleAutoFit(vm);
 
         if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
         {

+ 1 - 1
src/PicView.Core/Config/AppSettings.cs

@@ -19,7 +19,7 @@ public record WindowProperties
     public double Left { get; set; } = 0;
     public double Width { get; set; } = 750;
     public double Height { get; set; } = 1024;
-    public bool AutoFit { get; set; } = false;
+    public bool AutoFit { get; set; } = true;
     public bool TopMost { get; set; } = false;
     public bool Maximized { get; set; } = false;
     public bool Fullscreen { get; set; } = false;