1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

Fixed elements sometimes staying hidden when they shouldn't in scrolling panels

This commit is contained in:
Ell 2022-05-04 13:54:15 +02:00
parent 98118e540a
commit 16b9e26969
3 changed files with 10 additions and 3 deletions

View file

@ -34,6 +34,7 @@ Fixes
- Fixed auto-nav tooltip displaying on the selected element even when not in auto-nav mode - Fixed auto-nav tooltip displaying on the selected element even when not in auto-nav mode
- Fixed radio buttons not unchecking all other radio buttons with the same root element - Fixed radio buttons not unchecking all other radio buttons with the same root element
- Fixed elements not being deselected when removed through RemoveChild - Fixed elements not being deselected when removed through RemoveChild
- Fixed elements sometimes staying hidden when they shouldn't in scrolling panels
Removals Removals
- Marked old Draw and DrawTransformed overloads as obsolete in favor of SpriteBatchContext ones - Marked old Draw and DrawTransformed overloads as obsolete in favor of SpriteBatchContext ones

View file

@ -901,13 +901,14 @@ namespace MLEM.Ui.Elements {
} }
/// <summary> /// <summary>
/// Updates this element and all of its <see cref="GetRelevantChildren"/> /// Updates this element and all of its <see cref="SortedChildren"/>
/// </summary> /// </summary>
/// <param name="time">The game's time</param> /// <param name="time">The game's time</param>
public virtual void Update(GameTime time) { public virtual void Update(GameTime time) {
this.System.InvokeOnElementUpdated(this, time); this.System.InvokeOnElementUpdated(this, time);
foreach (var child in this.GetRelevantChildren()) { // update all sorted children, not just relevant ones, because they might become relevant or irrelevant through updates
foreach (var child in this.SortedChildren) {
if (child.System != null) if (child.System != null)
child.Update(time); child.Update(time);
} }

View file

@ -59,8 +59,13 @@ namespace MLEM.Ui.Elements {
set { set {
if (this.text != value) { if (this.text != value) {
this.text = value; this.text = value;
this.forceHide = string.IsNullOrWhiteSpace(this.text);
this.SetTextDirty(); this.SetTextDirty();
var force = string.IsNullOrWhiteSpace(this.text);
if (this.forceHide != force) {
this.forceHide = force;
this.SetAreaDirty();
}
} }
} }
} }