fix(ui): scroll revealed task into view + stronger selection highlight
This commit is contained in:
@@ -414,7 +414,7 @@
|
|||||||
<Setter Property="BorderBrush" Value="{StaticResource LineBrightBrush}" />
|
<Setter Property="BorderBrush" Value="{StaticResource LineBrightBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Border.task-row.selected">
|
<Style Selector="Border.task-row.selected">
|
||||||
<Setter Property="BorderBrush" Value="{StaticResource LineBrightBrush}" />
|
<Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
|
||||||
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
using System.Linq;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Layout;
|
using Avalonia.Layout;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
using Avalonia.Threading;
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
using ClaudeDo.Ui.ViewModels.Islands;
|
using ClaudeDo.Ui.ViewModels.Islands;
|
||||||
using ClaudeDo.Ui.ViewModels.Modals;
|
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).
|
// ShowDialog completes once the window is closed (CloseAction or OS close).
|
||||||
};
|
};
|
||||||
vm.ConfirmAsync = ShowConfirmAsync;
|
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)
|
private async System.Threading.Tasks.Task<bool> ShowConfirmAsync(string message)
|
||||||
{
|
{
|
||||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||||
|
|||||||
Reference in New Issue
Block a user