Fix label vertical alignment

This commit is contained in:
Frank A. Krueger 2017-12-09 23:10:35 -08:00
parent 72af1a8a3a
commit 85c7c74270
2 changed files with 16 additions and 1 deletions

View File

@ -83,6 +83,19 @@ namespace Ooui.Forms.Extensions
}
}
public static string ToOouiVerticalAlign (this TextAlignment align)
{
switch (align) {
case TextAlignment.Start:
default:
return "top";
case TextAlignment.Center:
return "middle";
case TextAlignment.End:
return "bottom";
}
}
static readonly double[] CharacterProportions = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0.27799999713897705, 0.27799999713897705, 0.27799999713897705, 0.27799999713897705, 0.27799999713897705, 0, 0,

View File

@ -103,8 +103,10 @@ namespace Ooui.Forms.Renderers
void UpdateAlignment ()
{
this.Style.Display = "table";
Control.Style.Display = "table-cell";
this.Style.TextAlign = Element.HorizontalTextAlignment.ToOouiTextAlign ();
this.Style.VerticalAlign = Element.VerticalTextAlignment.ToOouiTextAlign ();
Control.Style.VerticalAlign = Element.VerticalTextAlignment.ToOouiVerticalAlign ();
}
void UpdateLineBreakMode ()