1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 17:59:24 +01:00

cleaned up element ui addition order (0fab7fe)

This commit is contained in:
Ell 2023-11-11 12:15:21 +01:00
parent 0fab7fe859
commit a233477b1e
2 changed files with 3 additions and 8 deletions

View file

@ -588,10 +588,7 @@ namespace MLEM.Ui.Elements {
index = this.children.Count;
this.children.Insert(index, element);
element.Parent = this;
element.AndChildren(e => {
e.SetAreaDirty();
e.AddedToUi(this.System, this.Root);
});
element.AndChildren(e => e.AddedToUi(this.System, this.Root));
this.OnChildAdded?.Invoke(this, element);
this.SetSortedChildrenDirty();
return element;
@ -1344,6 +1341,7 @@ namespace MLEM.Ui.Elements {
protected internal virtual void AddedToUi(UiSystem system, RootElement root) {
this.Root = root;
this.System = system;
this.SetAreaDirty();
this.OnAddedToUi?.Invoke(this);
root?.InvokeOnElementAdded(this);
}

View file

@ -351,10 +351,7 @@ namespace MLEM.Ui {
return null;
var root = new RootElement(name, element, this);
this.rootElements.Add(root);
root.Element.AndChildren(e => {
e.SetAreaDirty();
e.AddedToUi(this, root);
});
root.Element.AndChildren(e => e.AddedToUi(this, root));
this.OnRootAdded?.Invoke(root);
root.InvokeOnAddedToUi(this);
this.SortRoots();