Skip to content

Commit

Permalink
Fix for normal window and comments #185
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Feb 18, 2025
1 parent 05519da commit d6dd4ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/PicView.Avalonia/Views/ImageViewer.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ public void Pan(PointerEventArgs e)
var newXproperty = _origin.X - dragMousePosition.X;
var newYproperty = _origin.Y - dragMousePosition.Y;

if (Settings.WindowProperties.Fullscreen || Settings.WindowProperties.Maximized)
// #185
if (Settings.WindowProperties.Fullscreen || Settings.WindowProperties.Maximized || !Settings.WindowProperties.AutoFit)
{
// TODO: figure out how to pan when not auto fitting window while keeping it in bounds
_translateTransform.Transitions = null;
Expand Down
6 changes: 4 additions & 2 deletions src/PicView.Avalonia/WindowBehavior/WindowFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ private static void SetMargin()
{
if (Settings.WindowProperties.Maximized)
{
// Sometimes margin is 0 when it's not supposed to be, so replace with 7. Not sure why.
var left = desktop.MainWindow.OffScreenMargin.Left is 0 ? 7 : desktop.MainWindow.OffScreenMargin.Left;
var top = desktop.MainWindow.OffScreenMargin.Top is 0 ? 7 : desktop.MainWindow.OffScreenMargin.Top;
var right = desktop.MainWindow.OffScreenMargin.Right is 0 ? 7 : desktop.MainWindow.OffScreenMargin.Right;
Expand All @@ -364,8 +365,9 @@ private static void SetMargin()
}
else
{
vm.TopScreenMargin = new Thickness(0);
vm.BottomScreenMargin = new Thickness(0);
var noThickness = new Thickness(0);
vm.TopScreenMargin = noThickness;
vm.BottomScreenMargin = noThickness;
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
Expand Down

0 comments on commit d6dd4ff

Please sign in to comment.