fix(ui): scroll revealed task into view + stronger selection highlight
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
using ClaudeDo.Ui.ViewModels.Modals;
|
||||
@@ -36,10 +38,26 @@ public partial class TasksIslandView : UserControl
|
||||
// ShowDialog completes once the window is closed (CloseAction or OS close).
|
||||
};
|
||||
vm.ConfirmAsync = ShowConfirmAsync;
|
||||
vm.SelectionChanged += (_, _) => ScrollSelectedIntoView();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Bring the selected row into view — the task list is a plain ItemsControl with no
|
||||
// built-in selection scrolling, so a programmatic select (e.g. Mission Control's
|
||||
// "Open in app") would otherwise highlight a row that stays off-screen.
|
||||
private void ScrollSelectedIntoView()
|
||||
{
|
||||
if (DataContext is not TasksIslandViewModel vm || vm.SelectedTask is not { } target) return;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
var match = this.GetVisualDescendants()
|
||||
.OfType<Button>()
|
||||
.FirstOrDefault(b => ReferenceEquals(b.DataContext, target));
|
||||
match?.BringIntoView();
|
||||
}, DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task<bool> ShowConfirmAsync(string message)
|
||||
{
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
|
||||
Reference in New Issue
Block a user