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>
|
||||
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()
|
||||
{
|
||||
if (Children.Count == 0)
|
||||
{
|
||||
if (Root != null && Root.RootModule == this)
|
||||
{
|
||||
Root.NotifyLayoutEmpty();
|
||||
}
|
||||
base.CheckCleanup();
|
||||
}
|
||||
else if (Children.Count == 1)
|
||||
base.CheckCleanup();
|
||||
|
||||
if (Children.Count == 1)
|
||||
{
|
||||
var child = Children[0];
|
||||
var owner = Owner;
|
||||
|
||||
Reference in New Issue
Block a user