feat(dock): implement tab tear-off to new window

This commit is contained in:
2026-03-28 15:41:39 +09:00
parent 095fcc87a7
commit 07274b6699
3 changed files with 50 additions and 0 deletions

View File

@@ -290,10 +290,27 @@ public sealed partial class DockLayout : Control
tabView.DragLeave += TabView_DragLeave;
tabView.Drop += TabView_Drop;
tabView.TabDragStarting += TabView_TabDragStarting;
tabView.TabDroppedOutside += TabView_TabDroppedOutside;
return tabView;
}
private void TabView_TabDroppedOutside(Microsoft.UI.Xaml.Controls.TabView sender, Microsoft.UI.Xaml.Controls.TabViewTabDroppedOutsideEventArgs args)
{
if (_sourceNode != null && _draggedItem != null)
{
// Remove from current tree
_sourceNode.Items.Remove(_draggedItem);
DockMutationEngine.CleanupEmptyNodes(_sourceNode, Root);
// Create new window
var newWindow = new Ghost.Editor.View.Windows.DockWindow(_draggedItem);
newWindow.Activate();
ClearDragOperationState();
}
}
private object? _draggedItem;
private DockPanelNode? _sourceNode;
private DockPosition _currentDropPosition = DockPosition.None;