mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 04:53:29 +01:00
Skip unnecessary area updates for elements with dirty parents
This commit is contained in:
parent
60bd73017c
commit
f2939253b1
2 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue