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.
16b9e26969
...
58b716aabb
3 changed files with 6 additions and 16 deletions
|
@ -28,13 +28,11 @@ Improvements
|
||||||
- Turned Tooltip paragraph styling into style properties
|
- Turned Tooltip paragraph styling into style properties
|
||||||
- Improved ElementHelper.AddTooltip overloads
|
- Improved ElementHelper.AddTooltip overloads
|
||||||
- Don't query a paragraph's text callback in the constructor
|
- Don't query a paragraph's text callback in the constructor
|
||||||
- Allow manually hiding a paragraph without its text overriding the hidden state
|
|
||||||
|
|
||||||
Fixes
|
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
|
||||||
|
|
|
@ -901,14 +901,13 @@ namespace MLEM.Ui.Elements {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates this element and all of its <see cref="SortedChildren"/>
|
/// Updates this element and all of its <see cref="GetRelevantChildren"/>
|
||||||
/// </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);
|
||||||
|
|
||||||
// update all sorted children, not just relevant ones, because they might become relevant or irrelevant through updates
|
foreach (var child in this.GetRelevantChildren()) {
|
||||||
foreach (var child in this.SortedChildren) {
|
|
||||||
if (child.System != null)
|
if (child.System != null)
|
||||||
child.Update(time);
|
child.Update(time);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,13 +59,8 @@ namespace MLEM.Ui.Elements {
|
||||||
set {
|
set {
|
||||||
if (this.text != value) {
|
if (this.text != value) {
|
||||||
this.text = value;
|
this.text = value;
|
||||||
|
this.IsHidden = string.IsNullOrWhiteSpace(this.text);
|
||||||
this.SetTextDirty();
|
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 string text;
|
||||||
private StyleProp<TextAlignment> alignment;
|
private StyleProp<TextAlignment> alignment;
|
||||||
private StyleProp<GenericFont> regularFont;
|
private StyleProp<GenericFont> regularFont;
|
||||||
private bool forceHide;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new paragraph with the given settings.
|
/// 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="width">The paragraph's width. Note that its height is automatically calculated.</param>
|
||||||
/// <param name="textCallback">The paragraph's text</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>
|
/// <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;
|
this.GetTextCallback = textCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="Paragraph(Anchor,float,TextCallback,bool)"/>
|
/// <inheritdoc cref="Paragraph(Anchor,float,TextCallback,bool)"/>
|
||||||
public Paragraph(Anchor anchor, float width, string text, bool autoAdjustWidth = false) : base(anchor, new Vector2(width, 0)) {
|
public Paragraph(Anchor anchor, float width, string text, bool autoAdjustWidth = false) : base(anchor, new Vector2(width, 0)) {
|
||||||
|
this.IsHidden = true;
|
||||||
this.Text = text;
|
this.Text = text;
|
||||||
this.AutoAdjustWidth = autoAdjustWidth;
|
this.AutoAdjustWidth = autoAdjustWidth;
|
||||||
this.CanBeSelected = false;
|
this.CanBeSelected = false;
|
||||||
|
|
Loading…
Reference in a new issue