1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-10 03:28:43 +02:00

Skip unnecessary area updates for elements with dirty parents

This commit is contained in:
Ell 2021-11-01 13:39:37 +01:00
parent 60bd73017c
commit f2939253b1
2 changed files with 7 additions and 0 deletions

View file

@ -29,6 +29,7 @@ Improvements
- Added style properties for a lot of hardcoded default element styles
- Allow style properties to set style values with a higher priority, which allows elements to style their default children
- Allow changing the entire ui style for a single element
- Skip unnecessary area updates for elements with dirty parents
Fixes
- Fixed VerticalSpace height parameter being an integer

View file

@ -531,6 +531,12 @@ namespace MLEM.Ui.Elements {
this.areaDirty = false;
if (this.IsHidden)
return;
// if the parent's area is dirty, it would get updated anyway when querying its ChildPaddedArea,
// which would cause our ForceUpdateArea code to be run twice, so we only update our parent instead
if (this.Parent != null && this.Parent.areaDirty) {
this.Parent.ForceUpdateArea();
return;
}
var parentArea = this.Parent != null ? this.Parent.ChildPaddedArea : (RectangleF) this.system.Viewport;
var parentCenterX = parentArea.X + parentArea.Width / 2;