Bladeren bron

Reduce debounce time for window resize updates and improve window size handling

- Lowered debounce time from 100ms to 10ms in `ImageInfoWindow` for both MacOS and Win32, enabling faster resize updates.
- Fixed width and height assignment logic in `WindowFunctions` for consistent behavior.
- Added debug logging for invalid width and height values in `InitializeWindowSizeAndPosition`.
Ruben 5 maanden geleden
bovenliggende
commit
de58db6601

+ 1 - 1
src/PicView.Avalonia.MacOS/Views/ImageInfoWindow.axaml.cs

@@ -29,7 +29,7 @@ public partial class ImageInfoWindow : Window, IDisposable
         {
             ClientSizeProperty.Changed.ToObservable()
                 .ObserveOn(UIHelper.GetFrameProvider)
-                .Debounce(TimeSpan.FromMilliseconds(100))
+                .Debounce(TimeSpan.FromMilliseconds(10))
                 .Subscribe(UpdateWindowSize)
                 .AddTo(_disposables);
             PositionChanged += (_, __) => UpdateWindowPosition();

+ 1 - 1
src/PicView.Avalonia.Win32/Views/ImageInfoWindow.axaml.cs

@@ -96,7 +96,7 @@ public partial class ImageInfoWindow : Window, IDisposable
         {
             ClientSizeProperty.Changed.ToObservable()
                 .ObserveOn(UIHelper.GetFrameProvider)
-                .Debounce(TimeSpan.FromMilliseconds(100))
+                .Debounce(TimeSpan.FromMilliseconds(10))
                 .Subscribe(UpdateWindowSize)
                 .AddTo(_disposables);
             PositionChanged += (_, _) => UpdateWindowPosition();

+ 7 - 3
src/PicView.Avalonia/WindowBehavior/WindowFunctions.cs

@@ -11,6 +11,7 @@ using PicView.Avalonia.UI;
 using PicView.Avalonia.ViewModels;
 using PicView.Core.ArchiveHandling;
 using PicView.Core.Config;
+using PicView.Core.DebugTools;
 using PicView.Core.FileHandling;
 using PicView.Core.FileHistory;
 using PicView.Core.Sizing;
@@ -415,7 +416,10 @@ public static class WindowFunctions
                 window.Width = properties.Width.Value;
                 window.Height = properties.Height.Value;
             }
-
+            else
+            {
+                DebugHelper.LogDebug(nameof(WindowFunctions), nameof(InitializeWindowSizeAndPosition), "Invalid width and height values");
+            }
         }
     }
 
@@ -440,8 +444,8 @@ public static class WindowFunctions
         {
             return;
         }
-        properties.Width = size.NewValue.Value.Width;
-        properties.Height = size.NewValue.Value.Height;
+        properties.Width = window.Bounds.Width;
+        properties.Height = window.Bounds.Height;
     }
 
     #endregion