fix(docking): address code quality issues in Docking system
This commit is contained in:
@@ -53,14 +53,7 @@ public abstract class DockContainer : DockModule
|
|||||||
if (_children.Contains(module))
|
if (_children.Contains(module))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (module.Owner == this)
|
module.Owner?.RemoveChild(module);
|
||||||
{
|
|
||||||
RemoveChildInternal(module, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
module.Owner?.RemoveChild(module);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.Owner = this;
|
module.Owner = this;
|
||||||
module.Root = Root;
|
module.Root = Root;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class DockPanel : DockContainer
|
|||||||
{
|
{
|
||||||
if (child is DockPanel childPanel)
|
if (child is DockPanel childPanel)
|
||||||
{
|
{
|
||||||
|
RemoveChildInternal(childPanel, false);
|
||||||
Root.RootPanel = childPanel;
|
Root.RootPanel = childPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ public class DockingLayout : Control
|
|||||||
throw new InvalidOperationException("Panel is already owned by another DockingLayout");
|
throw new InvalidOperationException("Panel is already owned by another DockingLayout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newPanel.Owner != null)
|
||||||
|
{
|
||||||
|
newPanel.Owner.RemoveChild(newPanel);
|
||||||
|
}
|
||||||
|
|
||||||
newPanel.Root = layout;
|
newPanel.Root = layout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user