mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Fixed an exception when trying to force-update the area of an element without a ui system
This commit is contained in:
parent
02cf01fcb7
commit
e8710f69e9
2 changed files with 3 additions and 2 deletions
|
@ -45,6 +45,7 @@ Fixes
|
|||
- Fixed panels sometimes not drawing children that came into view when their positions changed unexpectedly
|
||||
- Fixed UiMarkdownParser not parsing formatting in headings and blockquotes
|
||||
- Fixed Element.OnChildAdded and Element.OnChildRemoved being called for grandchildren when a child is added
|
||||
- Fixed an exception when trying to force-update the area of an element without a ui system
|
||||
|
||||
### MLEM.Data
|
||||
Additions
|
||||
|
|
|
@ -452,7 +452,7 @@ namespace MLEM.Ui.Elements {
|
|||
/// The <see cref="ChildPaddedArea"/> of this element's <see cref="Parent"/>, or the <see cref="UiSystem.Viewport"/> if this element has no parent.
|
||||
/// This value is the one that is passed to <see cref="CalcActualSize"/> during <see cref="ForceUpdateArea"/>.
|
||||
/// </summary>
|
||||
protected RectangleF ParentArea => this.Parent?.ChildPaddedArea ?? (RectangleF) this.system.Viewport;
|
||||
protected RectangleF ParentArea => this.Parent?.ChildPaddedArea ?? (RectangleF) this.System.Viewport;
|
||||
|
||||
private readonly List<Element> children = new List<Element>();
|
||||
private readonly Stopwatch stopwatch = new Stopwatch();
|
||||
|
@ -601,7 +601,7 @@ namespace MLEM.Ui.Elements {
|
|||
/// </summary>
|
||||
public virtual void ForceUpdateArea() {
|
||||
this.AreaDirty = false;
|
||||
if (this.IsHidden)
|
||||
if (this.IsHidden || this.System == null)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue