Преглед на файлове

Fix window not filling whole screen #226

Ruben преди 3 месеца
родител
ревизия
3c3edb9d3b
променени са 2 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 2 0
      src/PicView.Avalonia.Win32/WindowImpl/Win32Window.cs
  2. 6 1
      src/PicView.Avalonia/WindowBehavior/WindowFunctions.cs

+ 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
         // Fixes https://github.com/Ruben2776/PicView/issues/226
         await WindowFunctions.ResizeAndFixRenderingError(vm);
         await WindowFunctions.ResizeAndFixRenderingError(vm);
 
 
+        // Fix 1to1 incorrect rendering and not filling the whole window #226
         if (vm.PicViewer.PixelWidth.CurrentValue == vm.PicViewer.PixelHeight.CurrentValue)
         if (vm.PicViewer.PixelWidth.CurrentValue == vm.PicViewer.PixelHeight.CurrentValue)
         {
         {
             WindowFunctions.Fix1to1(vm);
             WindowFunctions.Fix1to1(vm);
         }
         }
+        WindowFunctions.FixBorderLayout(vm);
 
 
         Dispatcher.UIThread.Post(() => IsChangingWindowState = false, DispatcherPriority.Background);
         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);
         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;
         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)
     public static void ShowMinimizedWindow(Window window)
     {
     {