From d117faa48dc12bdfa1f2f13da2abed43d73dc9f7 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 12 Oct 2014 18:40:15 +1300 Subject: [PATCH] Define BaseLine offset for ButtonWidget. --- OpenRA.Game/Widgets/ButtonWidget.cs | 4 +++- OpenRA.Game/Widgets/CheckboxWidget.cs | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Widgets/ButtonWidget.cs b/OpenRA.Game/Widgets/ButtonWidget.cs index 9173891190..c041f790fa 100644 --- a/OpenRA.Game/Widgets/ButtonWidget.cs +++ b/OpenRA.Game/Widgets/ButtonWidget.cs @@ -26,6 +26,7 @@ namespace OpenRA.Widgets public string Background = "button"; public bool Depressed = false; public int VisualHeight = ChromeMetrics.Get("ButtonDepth"); + public int BaseLine = 0; public string Font = ChromeMetrics.Get("ButtonFont"); public Color TextColor = ChromeMetrics.Get("ButtonTextColor"); public Color TextColorDisabled = ChromeMetrics.Get("ButtonTextColorDisabled"); @@ -78,6 +79,7 @@ namespace OpenRA.Widgets Text = other.Text; Font = other.Font; + BaseLine = other.BaseLine; TextColor = other.TextColor; TextColorDisabled = other.TextColorDisabled; Contrast = other.Contrast; @@ -202,7 +204,7 @@ namespace OpenRA.Widgets var contrast = GetContrastColor(); var s = font.Measure(text); var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0); - var position = new int2(rb.X + (UsableWidth - s.X) / 2, rb.Y + (Bounds.Height - s.Y) / 2); + var position = new int2(rb.X + (UsableWidth - s.X) / 2, rb.Y - BaseLine + (Bounds.Height - s.Y) / 2); DrawBackground(rb, disabled, Depressed, Ui.MouseOverWidget == this, highlighted); if (Contrast) diff --git a/OpenRA.Game/Widgets/CheckboxWidget.cs b/OpenRA.Game/Widgets/CheckboxWidget.cs index 29a2726ac4..52b71c6c2d 100644 --- a/OpenRA.Game/Widgets/CheckboxWidget.cs +++ b/OpenRA.Game/Widgets/CheckboxWidget.cs @@ -19,7 +19,6 @@ namespace OpenRA.Widgets public string CheckType = "checked"; public Func GetCheckType; public Func IsChecked = () => false; - public int BaseLine = 1; public int CheckOffset = 2; public bool HasPressedState = ChromeMetrics.Get("CheckboxPressedState"); @@ -36,7 +35,6 @@ namespace OpenRA.Widgets CheckType = other.CheckType; GetCheckType = other.GetCheckType; IsChecked = other.IsChecked; - BaseLine = other.BaseLine; CheckOffset = other.CheckOffset; HasPressedState = other.HasPressedState; }