mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
fixed up Element docs and added a return value to UpdateAreaIfDirty
This commit is contained in:
parent
f2939253b1
commit
149669df99
1 changed files with 13 additions and 6 deletions
|
@ -35,6 +35,11 @@ namespace MLEM.Ui.Elements {
|
|||
this.Style = value?.Style;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// This Element's current <see cref="UiStyle"/>.
|
||||
/// When this value is changed, <see cref="InitStyle"/> is called.
|
||||
/// Note that this value is automatically set to the <see cref="UiSystem"/>'s ui style when it is changed.
|
||||
/// </summary>
|
||||
public UiStyle Style {
|
||||
get => this.style;
|
||||
set {
|
||||
|
@ -516,11 +521,15 @@ namespace MLEM.Ui.Elements {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates this element's <see cref="Area"/> list if <see cref="areaDirty"/> is true.
|
||||
/// Updates this element's <see cref="Area"/> and all of its <see cref="Children"/> by calling <see cref="ForceUpdateArea"/> if <see cref="areaDirty"/> is true.
|
||||
/// </summary>
|
||||
public void UpdateAreaIfDirty() {
|
||||
if (this.areaDirty)
|
||||
/// <returns>Whether <see cref="areaDirty"/> was true and <see cref="ForceUpdateArea"/> was called</returns>
|
||||
public bool UpdateAreaIfDirty() {
|
||||
if (this.areaDirty) {
|
||||
this.ForceUpdateArea();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -533,10 +542,8 @@ namespace MLEM.Ui.Elements {
|
|||
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();
|
||||
if (this.Parent != null && this.Parent.UpdateAreaIfDirty())
|
||||
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