From 85e63ac9987c3560b65189c3baa4fc72c95f9184 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 17 May 2020 00:33:16 +0200 Subject: [PATCH] modify unnecessarily thorough SetAreaDirty when adding/removing children --- MLEM.Ui/Elements/Element.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index 2317261..920c162 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -183,12 +183,15 @@ namespace MLEM.Ui.Elements { this.Root.OnElementAdded(e); }); this.SetSortedChildrenDirty(); - this.SetAreaDirty(); + element.SetAreaDirty(); return element; } public void RemoveChild(Element element) { this.Children.Remove(element); + // set area dirty here so that a dirty call is made + // upwards to us if the element is auto-positioned + element.SetAreaDirty(); element.Parent = null; element.AndChildren(e => { e.Root = null; @@ -197,7 +200,6 @@ namespace MLEM.Ui.Elements { this.Root.OnElementRemoved(e); }); this.SetSortedChildrenDirty(); - this.SetAreaDirty(); } public void RemoveChildren(Func condition = null) {