diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index f5ecbc5..842d788 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -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); } diff --git a/MLEM.Ui/UiSystem.cs b/MLEM.Ui/UiSystem.cs index 65dbd73..1dd2752 100644 --- a/MLEM.Ui/UiSystem.cs +++ b/MLEM.Ui/UiSystem.cs @@ -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();