fix(docking): address final code quality issues in docking layout

This commit is contained in:
2026-03-28 23:01:28 +09:00
parent 666528263b
commit 2946b905c6
4 changed files with 60 additions and 39 deletions

View File

@@ -48,6 +48,10 @@ public class DockPanel : DockContainer
{
if (Children.Count == 0)
{
if (Root != null && Root.RootModule == this)
{
Root.NotifyLayoutEmpty();
}
base.CheckCleanup();
}
else if (Children.Count == 1)
@@ -59,16 +63,10 @@ public class DockPanel : DockContainer
{
owner.ReplaceChild(this, child);
}
else if (Root != null && Root.RootPanel == this)
else if (Root != null && Root.RootModule == this)
{
// We only collapse the root panel if the child is also a DockPanel
// because DockingLayout.RootPanel is strongly typed as DockPanel,
// so we can't assign a DockGroup to it directly.
if (child is DockPanel childPanel)
{
RemoveChildInternal(childPanel, false);
Root.RootPanel = childPanel;
}
RemoveChildInternal(child, false);
Root.RootModule = child;
}
}
}