1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 14:08:34 +01:00

Compare commits

..

No commits in common. "16b9e2696949ac5a565c9075acce934602d316c2" and "58b716aabb0aa92df4d4c430b6dd1a331229769a" have entirely different histories.

3 changed files with 6 additions and 16 deletions

View file

@ -28,13 +28,11 @@ Improvements
- Turned Tooltip paragraph styling into style properties
- Improved ElementHelper.AddTooltip overloads
- Don't query a paragraph's text callback in the constructor
- Allow manually hiding a paragraph without its text overriding the hidden state
Fixes
- 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 elements not being deselected when removed through RemoveChild
- Fixed elements sometimes staying hidden when they shouldn't in scrolling panels
Removals
- Marked old Draw and DrawTransformed overloads as obsolete in favor of SpriteBatchContext ones

View file

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

View file

@ -59,13 +59,8 @@ namespace MLEM.Ui.Elements {
set {
if (this.text != value) {
this.text = value;
this.IsHidden = string.IsNullOrWhiteSpace(this.text);
this.SetTextDirty();
var force = string.IsNullOrWhiteSpace(this.text);
if (this.forceHide != force) {
this.forceHide = force;
this.SetAreaDirty();
}
}
}
}
@ -104,13 +99,9 @@ namespace MLEM.Ui.Elements {
}
}
/// <inheritdoc />
public override bool IsHidden => base.IsHidden || this.forceHide;
private string text;
private StyleProp<TextAlignment> alignment;
private StyleProp<GenericFont> regularFont;
private bool forceHide;
/// <summary>
/// Creates a new paragraph with the given settings.
@ -119,12 +110,14 @@ namespace MLEM.Ui.Elements {
/// <param name="width">The paragraph's width. Note that its height is automatically calculated.</param>
/// <param name="textCallback">The paragraph's text</param>
/// <param name="autoAdjustWidth">Whether the paragraph's width should automatically be calculated based on the text within it.</param>
public Paragraph(Anchor anchor, float width, TextCallback textCallback, bool autoAdjustWidth = false) : this(anchor, width, string.Empty, autoAdjustWidth) {
public Paragraph(Anchor anchor, float width, TextCallback textCallback, bool autoAdjustWidth = false) : this(anchor, width, "", autoAdjustWidth) {
this.IsHidden = true;
this.GetTextCallback = textCallback;
}
/// <inheritdoc cref="Paragraph(Anchor,float,TextCallback,bool)"/>
public Paragraph(Anchor anchor, float width, string text, bool autoAdjustWidth = false) : base(anchor, new Vector2(width, 0)) {
this.IsHidden = true;
this.Text = text;
this.AutoAdjustWidth = autoAdjustWidth;
this.CanBeSelected = false;