Jelajahi Sumber

Fix window not filling whole screen #226

Ruben 3 bulan lalu
induk
melakukan
3c3edb9d3b

+ 2 - 0
src/PicView.Avalonia.Win32/WindowImpl/Win32Window.cs

@@ -46,10 +46,12 @@ public static class Win32Window
         // Fixes https://github.com/Ruben2776/PicView/issues/226
         await WindowFunctions.ResizeAndFixRenderingError(vm);
 
+        // Fix 1to1 incorrect rendering and not filling the whole window #226
         if (vm.PicViewer.PixelWidth.CurrentValue == vm.PicViewer.PixelHeight.CurrentValue)
         {
             WindowFunctions.Fix1to1(vm);
         }
+        WindowFunctions.FixBorderLayout(vm);
 
         Dispatcher.UIThread.Post(() => IsChangingWindowState = false, DispatcherPriority.Background);
 

+ 6 - 1
src/PicView.Avalonia/WindowBehavior/WindowFunctions.cs

@@ -173,9 +173,14 @@ public static class WindowFunctions
         }
 
         WindowResizing.SetSize(size.Value, vm);
-        vm.ImageViewer.MainBorder.Height = size.Value.Width;
+        vm.ImageViewer.MainBorder.Height = size!.Value.Width;
         vm.ImageViewer.MainBorder.Width = size.Value.Height;
     }
+    
+    public static void FixBorderLayout(MainViewModel vm)
+    {
+        vm.ImageViewer.MainBorder.Height = double.NaN;
+    }
 
     public static void ShowMinimizedWindow(Window window)
     {