mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-01 19:12:08 +03:00
Avoid reentrant log scrolling during Avalonia window dragging (#10271)
This commit is contained in:
@@ -47,9 +47,14 @@ public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
||||
if (togScrollToEnd.IsChecked ?? true)
|
||||
{
|
||||
txtMsg.ScrollToEnd();
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
txtMsg.ScrollTo(txtMsg.LineCount, 0, AvaloniaEdit.Rendering.VisualYPosition.TextBottom, txtMsg.Bounds.Height, 0),
|
||||
DispatcherPriority.Background);
|
||||
// Let layout finish without a nested dispatcher loop during a native window drag.
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
if (togScrollToEnd.IsChecked ?? true)
|
||||
{
|
||||
txtMsg.ScrollTo(txtMsg.LineCount, 0, AvaloniaEdit.Rendering.VisualYPosition.TextBottom, txtMsg.Bounds.Height, 0);
|
||||
}
|
||||
}, DispatcherPriority.Background);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user