feat(mission-control): swap tiles by dragging their header
This commit is contained in:
@@ -729,7 +729,18 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
|
||||
pane.Dispose();
|
||||
}
|
||||
|
||||
// Mirrors ConPtySessions' add/remove 1:1 into Panes (typed as the pane abstraction).
|
||||
/// <summary>Swaps two tiles' slots (overview-grid drag and drop); also reorders the focus-mode tabs.</summary>
|
||||
public void SwapPanes(ConPtyPaneViewModel a, ConPtyPaneViewModel b)
|
||||
{
|
||||
var i = ConPtySessions.IndexOf(a);
|
||||
var j = ConPtySessions.IndexOf(b);
|
||||
if (i < 0 || j < 0 || i == j) return;
|
||||
if (i > j) (i, j) = (j, i);
|
||||
ConPtySessions.Move(i, j);
|
||||
ConPtySessions.Move(j - 1, i);
|
||||
}
|
||||
|
||||
// Mirrors ConPtySessions' add/remove/move 1:1 into Panes (typed as the pane abstraction).
|
||||
private void OnConPtySessionsChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
switch (e.Action)
|
||||
@@ -740,6 +751,9 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Panes.RemoveAt(e.OldStartingIndex);
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Move:
|
||||
Panes.Move(e.OldStartingIndex, e.NewStartingIndex);
|
||||
break;
|
||||
default: // Reset
|
||||
Panes.Clear();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user