Make auto-scroll mean the same thing in both UIs

WinForms had been changed to pin the first active download to the top on every
start, which interrupts anyone who has scrolled further down the queue - the
behaviour master's comment says it deliberately avoids. Avalonia kept master's
gentler version but never read the setting, so Chardonnay's checkbox did nothing.

Both now run master's logic - scroll the new item into view only when the
previous one is visible - gated by AutoScrollQueue. VirtualFlowControl.ScrollToTop
had no callers left, so it goes.
This commit is contained in:
Allamagoosa
2026-08-20 13:19:32 -07:00
parent 059b817b03
commit 5d0ed3af68
3 changed files with 12 additions and 15 deletions

View File

@@ -51,11 +51,16 @@ internal partial class ProcessQueueControl : UserControl
if (!ViewModel.AutoScrollQueue) return;
Invoke(() =>
{
// Pin the first active download to the top so all parallel in-progress items are visible.
int firstActiveIndex = ViewModel.Queue.Completed.Count;
if (firstActiveIndex < ViewModel.Queue.Count)
virtualFlowControl2.ScrollToTop(firstActiveIndex);
if (ViewModel.Queue?.IndexOf(e) is int newtBookIndex && newtBookIndex > 0 && itemIsVisible(newtBookIndex - 1))
{
// Only scroll the new item into view if the previous item is visible.
// This allows users to scroll through the queue without being interrupted.
virtualFlowControl2.ScrollIntoView(newtBookIndex);
}
});
bool itemIsVisible(int newtBookIndex)
=> virtualFlowControl2.FirstRealizedIndex <= newtBookIndex && virtualFlowControl2.LastRealizedIndex >= newtBookIndex;
}
private void LogEntries_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)