fix(docking): improve root cleanup and simplify DockPanel cleanup logic
This commit is contained in:
@@ -132,9 +132,17 @@ public abstract class DockContainer : DockModule
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void CheckCleanup()
|
protected virtual void CheckCleanup()
|
||||||
{
|
{
|
||||||
if (_children.Count == 0)
|
if (Children.Count == 0)
|
||||||
{
|
{
|
||||||
Owner?.RemoveChildInternal(this, true);
|
if (Owner != null)
|
||||||
|
{
|
||||||
|
Owner.RemoveChildInternal(this, true);
|
||||||
|
}
|
||||||
|
else if (Root != null && Root.RootModule == this)
|
||||||
|
{
|
||||||
|
Root.RootModule = null;
|
||||||
|
Root.NotifyLayoutEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,15 +46,9 @@ public class DockPanel : DockContainer
|
|||||||
|
|
||||||
protected override void CheckCleanup()
|
protected override void CheckCleanup()
|
||||||
{
|
{
|
||||||
if (Children.Count == 0)
|
base.CheckCleanup();
|
||||||
{
|
|
||||||
if (Root != null && Root.RootModule == this)
|
if (Children.Count == 1)
|
||||||
{
|
|
||||||
Root.NotifyLayoutEmpty();
|
|
||||||
}
|
|
||||||
base.CheckCleanup();
|
|
||||||
}
|
|
||||||
else if (Children.Count == 1)
|
|
||||||
{
|
{
|
||||||
var child = Children[0];
|
var child = Children[0];
|
||||||
var owner = Owner;
|
var owner = Owner;
|
||||||
|
|||||||
Reference in New Issue
Block a user