Browse Source

[Avalonia] fix unintended call to resize

Ruben 1 year ago
parent
commit
8c217b5d0f

+ 0 - 7
src/PicView.Avalonia/Navigation/QuickLoad.cs

@@ -56,13 +56,6 @@ public static class QuickLoad
             
         SetTitleHelper.SetTitle(vm, imageModel);
         vm.GetIndex = vm.ImageIterator.CurrentIndex + 1;
-        if (SettingsHelper.Settings.WindowProperties.KeepCentered || SettingsHelper.Settings.WindowProperties.AutoFit)
-        {
-            await Dispatcher.UIThread.InvokeAsync(() =>
-            {
-                WindowHelper.CenterWindowOnScreen();
-            }, DispatcherPriority.Send);
-        }
 
         if (SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled)
         {

+ 5 - 9
src/PicView.Avalonia/UI/WindowHelper.cs

@@ -424,17 +424,13 @@ public static class WindowHelper
         {
             if (vm.FileInfo is null)
             {
-                switch (vm.ImageSource)
+                if (vm.ImageSource is Bitmap bitmap)
                 {
-                    default:
-                        firstWidth = SizeDefaults.WindowMinSize;
-                        firstHeight = SizeDefaults.WindowMinSize;
-                        break;
-                    case Bitmap bitmap:
-                        firstWidth = bitmap.PixelSize.Width;
-                        firstHeight = bitmap.PixelSize.Height;
-                        break;
+                    firstWidth = bitmap.PixelSize.Width;
+                    firstHeight = bitmap.PixelSize.Height;
                 }
+                else 
+                    return;
             }
             else
             {