VAlign correctly in LabelWidget

This commit is contained in:
teinarss
2019-05-02 19:44:52 +02:00
committed by reaperrr
parent 2d1c110857
commit 0e3d343f15

View File

@@ -49,6 +49,7 @@ namespace OpenRA.Mods.Common.Widgets
{ {
Text = other.Text; Text = other.Text;
Align = other.Align; Align = other.Align;
VAlign = other.VAlign;
Font = other.Font; Font = other.Font;
TextColor = other.TextColor; TextColor = other.TextColor;
Contrast = other.Contrast; Contrast = other.Contrast;
@@ -74,9 +75,13 @@ namespace OpenRA.Mods.Common.Widgets
var textSize = font.Measure(text); var textSize = font.Measure(text);
var position = RenderOrigin; var position = RenderOrigin;
var offset = font.TopOffset;
if (VAlign == TextVAlign.Top)
position += new int2(0, -offset);
if (VAlign == TextVAlign.Middle) if (VAlign == TextVAlign.Middle)
position += new int2(0, (Bounds.Height - textSize.Y) / 2); position += new int2(0, (Bounds.Height - textSize.Y - offset) / 2);
if (VAlign == TextVAlign.Bottom) if (VAlign == TextVAlign.Bottom)
position += new int2(0, Bounds.Height - textSize.Y); position += new int2(0, Bounds.Height - textSize.Y);