Skip to content

Commit 2ebb292

Browse files
committed
Fix window not centering when AutoFit is enabled during startup with folder or archive
1 parent bc6d256 commit 2ebb292

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/PicView.Avalonia/StartUp/QuickLoad.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public static async ValueTask QuickLoadAsync(MainViewModel vm, string file, Wind
3939
vm.MainWindow.IsLoadingIndicatorShown.Value = true;
4040
Dispatcher.UIThread.Invoke(window.Show, DispatcherPriority.Send);
4141
await NavigationManager.LoadPicFromStringAsync(file, vm).ConfigureAwait(false);
42+
if (Settings.WindowProperties.AutoFit)
43+
{
44+
await Dispatcher.UIThread.InvokeAsync(() => { WindowFunctions.CenterWindowOnScreen(); },
45+
DispatcherPriority.Send);
46+
}
4247
return;
4348
}
4449

@@ -47,6 +52,11 @@ public static async ValueTask QuickLoadAsync(MainViewModel vm, string file, Wind
4752
vm.MainWindow.IsLoadingIndicatorShown.Value = true;
4853
Dispatcher.UIThread.Invoke(window.Show, DispatcherPriority.Send);
4954
await NavigationManager.LoadPicFromArchiveAsync(file, vm).ConfigureAwait(false);
55+
if (Settings.WindowProperties.AutoFit)
56+
{
57+
await Dispatcher.UIThread.InvokeAsync(() => { WindowFunctions.CenterWindowOnScreen(); },
58+
DispatcherPriority.Send);
59+
}
5060
return;
5161
}
5262

0 commit comments

Comments
 (0)