mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 05:58:35 +01:00
Compare commits
2 commits
58b716aabb
...
16b9e26969
Author | SHA1 | Date | |
---|---|---|---|
16b9e26969 | |||
98118e540a |
3 changed files with 16 additions and 6 deletions
|
@ -28,11 +28,13 @@ 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
|
||||
|
|
|
@ -901,13 +901,14 @@ namespace MLEM.Ui.Elements {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates this element and all of its <see cref="GetRelevantChildren"/>
|
||||
/// Updates this element and all of its <see cref="SortedChildren"/>
|
||||
/// </summary>
|
||||
/// <param name="time">The game's time</param>
|
||||
public virtual void Update(GameTime 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)
|
||||
child.Update(time);
|
||||
}
|
||||
|
|
|
@ -59,8 +59,13 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,9 +104,13 @@ 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.
|
||||
|
@ -110,14 +119,12 @@ 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, "", autoAdjustWidth) {
|
||||
this.IsHidden = true;
|
||||
public Paragraph(Anchor anchor, float width, TextCallback textCallback, bool autoAdjustWidth = false) : this(anchor, width, string.Empty, autoAdjustWidth) {
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue