浏览代码

Auto-fit window by default if no settings exist

Ruben 9 月之前
父节点
当前提交
d7264eb514
共有 2 个文件被更改,包括 4 次插入10 次删除
  1. 3 9
      src/PicView.Avalonia/StartUp/StartUpHelper.cs
  2. 1 1
      src/PicView.Core/Config/AppSettings.cs

+ 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;