mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Allow manually hiding a paragraph without its text overriding the hidden state
This commit is contained in:
parent
58b716aabb
commit
98118e540a
2 changed files with 7 additions and 4 deletions
|
@ -28,6 +28,7 @@ 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
|
||||||
|
|
|
@ -59,7 +59,7 @@ 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.forceHide = string.IsNullOrWhiteSpace(this.text);
|
||||||
this.SetTextDirty();
|
this.SetTextDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,9 +99,13 @@ 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.
|
||||||
|
@ -110,14 +114,12 @@ 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, "", autoAdjustWidth) {
|
public Paragraph(Anchor anchor, float width, TextCallback textCallback, bool autoAdjustWidth = false) : this(anchor, width, string.Empty, 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