Skip to content

Commit

Permalink
fix race condition when updating size
Browse files Browse the repository at this point in the history
  • Loading branch information
jgcodes2020 committed Aug 17, 2023
1 parent ab3f55d commit e169c41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions M64RPFW.ViewModels/LuaViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ private void Stop()
[RelayCommand]
private void Run()
{
// TODO: investigate window sizing service reporting wrong dimensions when resized in quick succession
// https://discord.com/channels/723573549607944272/883784450108960769/1141361872373821550
if (IsRunning)
Stop();

Expand Down
7 changes: 5 additions & 2 deletions M64RPFW.Views.Avalonia/Views/MainWindow_Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public partial class MainWindow : IViewDialogService, ILuaInterfaceService

public WindowSize GetWindowSize()
{
return Dispatcher.UIThread.Invoke(() => new WindowSize(GlControl.Bounds.Width, GlControl.Bounds.Height));
return Dispatcher.UIThread.Invoke(() =>
{
return new WindowSize(GlControl.Bounds.Width, GlControl.Bounds.Height);
});
}


Expand All @@ -43,7 +46,7 @@ public void SizeToFit(WindowSize size)
// TODO synchronize this somehow
GlControl.MinWidth = GlControl.MaxWidth = size.Width;
GlControl.MinHeight = GlControl.MaxHeight = size.Height;
InvalidateMeasure();
UpdateLayout();
});
}

Expand Down

0 comments on commit e169c41

Please sign in to comment.