diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f00a6b..809fb83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/MLEM.Ui/Elements/Paragraph.cs b/MLEM.Ui/Elements/Paragraph.cs index 41065a9..3f127b5 100644 --- a/MLEM.Ui/Elements/Paragraph.cs +++ b/MLEM.Ui/Elements/Paragraph.cs @@ -110,19 +110,15 @@ namespace MLEM.Ui.Elements { /// The paragraph's width. Note that its height is automatically calculated. /// The paragraph's text /// Whether the paragraph's width should automatically be calculated based on the text within it. - 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; } /// 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;