mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
made paragraphs and images use their callbacks when updating their area so that the first visible frame already has the right data
This commit is contained in:
parent
c704aa6160
commit
ca258fe41a
2 changed files with 12 additions and 1 deletions
|
@ -56,6 +56,12 @@ namespace MLEM.Ui.Elements {
|
||||||
return this.texture != null && this.scaleToImage ? this.texture.Size.ToVector2() : base.CalcActualSize(parentArea);
|
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) {
|
public override void Update(GameTime time) {
|
||||||
base.Update(time);
|
base.Update(time);
|
||||||
if (this.GetTextureCallback != null)
|
if (this.GetTextureCallback != null)
|
||||||
|
|
|
@ -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);
|
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) {
|
public override void Update(GameTime time) {
|
||||||
base.Update(time);
|
base.Update(time);
|
||||||
if (this.GetTextCallback != null)
|
if (this.GetTextCallback != null)
|
||||||
|
@ -103,5 +109,4 @@ namespace MLEM.Ui.Elements {
|
||||||
public delegate string TextCallback(Paragraph paragraph);
|
public delegate string TextCallback(Paragraph paragraph);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue