feat(ui): drag-reorder Mission Control panes by their header
This commit is contained in:
@@ -1,8 +1,26 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.VisualTree;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
namespace ClaudeDo.Ui.Views.MissionControl;
|
||||
|
||||
public partial class MonitorPaneView : UserControl
|
||||
{
|
||||
public MonitorPaneView() => InitializeComponent();
|
||||
|
||||
private async void OnHeaderPressed(object? sender, PointerPressedEventArgs e)
|
||||
{
|
||||
if (DataContext is not TaskMonitorViewModel m || m.SubscribedTaskId is not { } id) return;
|
||||
if (e.Source is not Avalonia.Visual src) return;
|
||||
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
|
||||
|
||||
// Don't start a drag when the press landed on a header action button.
|
||||
var button = src as Button ?? src.FindAncestorOfType<Button>();
|
||||
if (button is not null) return;
|
||||
|
||||
var data = new DataTransfer();
|
||||
data.Add(DataTransferItem.Create(MissionControlView.PaneFormat, id));
|
||||
await DragDrop.DoDragDropAsync(e, data, DragDropEffects.Move);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user