diff --git a/MLEM.Ui/Elements/Image.cs b/MLEM.Ui/Elements/Image.cs index 0e55ade..6b73e93 100644 --- a/MLEM.Ui/Elements/Image.cs +++ b/MLEM.Ui/Elements/Image.cs @@ -56,6 +56,12 @@ namespace MLEM.Ui.Elements { return this.texture != null && this.scaleToImage ? this.texture.Size.ToVector2() : base.CalcActualSize(parentArea); } + public override void ForceUpdateArea() { + if (this.GetTextureCallback != null) + this.Texture = this.GetTextureCallback(this); + base.ForceUpdateArea(); + } + public override void Update(GameTime time) { base.Update(time); if (this.GetTextureCallback != null) diff --git a/MLEM.Ui/Elements/Paragraph.cs b/MLEM.Ui/Elements/Paragraph.cs index 986ee2d..16e5db3 100644 --- a/MLEM.Ui/Elements/Paragraph.cs +++ b/MLEM.Ui/Elements/Paragraph.cs @@ -67,6 +67,12 @@ namespace MLEM.Ui.Elements { return new Vector2(this.AutoAdjustWidth ? textDims.X + this.ScaledPadding.Width : size.X, textDims.Y + this.ScaledPadding.Height); } + public override void ForceUpdateArea() { + if (this.GetTextCallback != null) + this.Text = this.GetTextCallback(this); + base.ForceUpdateArea(); + } + public override void Update(GameTime time) { base.Update(time); if (this.GetTextCallback != null) @@ -103,5 +109,4 @@ namespace MLEM.Ui.Elements { public delegate string TextCallback(Paragraph paragraph); } - } \ No newline at end of file