1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-10 03:28:43 +02:00

Don't query a paragraph's text callback in the constructor

This commit is contained in:
Ell 2022-05-03 20:26:39 +02:00
parent 63d2353694
commit 58b716aabb
2 changed files with 4 additions and 7 deletions

View file

@ -27,6 +27,7 @@ Improvements
- Allow adding dropdown elements at a specified index
- Turned Tooltip paragraph styling into style properties
- Improved ElementHelper.AddTooltip overloads
- Don't query a paragraph's text callback in the constructor
Fixes
- Fixed auto-nav tooltip displaying on the selected element even when not in auto-nav mode

View file

@ -110,19 +110,15 @@ 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) {
public Paragraph(Anchor anchor, float width, TextCallback textCallback, bool autoAdjustWidth = false) : this(anchor, width, "", autoAdjustWidth) {
this.IsHidden = true;
this.GetTextCallback = textCallback;
this.Text = textCallback(this);
if (this.Text == null)
this.IsHidden = true;
}
/// <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;
if (this.Text == null)
this.IsHidden = true;
this.AutoAdjustWidth = autoAdjustWidth;
this.CanBeSelected = false;
this.CanBeMoused = false;