Moved duplicated int2 in ButtonWidget before if as suggested.
This commit is contained in:
@@ -194,13 +194,14 @@ namespace OpenRA.Widgets
|
|||||||
var contrast = GetContrastColor();
|
var contrast = GetContrastColor();
|
||||||
var s = font.Measure(text);
|
var s = font.Measure(text);
|
||||||
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
|
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);
|
||||||
|
|
||||||
DrawBackground(rb, disabled, Depressed, Ui.MouseOverWidget == this, highlighted);
|
DrawBackground(rb, disabled, Depressed, Ui.MouseOverWidget == this, highlighted);
|
||||||
if (Contrast)
|
if (Contrast)
|
||||||
font.DrawTextWithContrast(text, new int2(rb.X + (UsableWidth - s.X) / 2, rb.Y + (Bounds.Height - s.Y) / 2) + stateOffset,
|
font.DrawTextWithContrast(text, position + stateOffset,
|
||||||
disabled ? colordisabled : color, contrast, 2);
|
disabled ? colordisabled : color, contrast, 2);
|
||||||
else
|
else
|
||||||
font.DrawText(text, new int2(rb.X + (UsableWidth - s.X)/ 2, rb.Y + (Bounds.Height - s.Y) / 2) + stateOffset,
|
font.DrawText(text, position + stateOffset,
|
||||||
disabled ? colordisabled : color);
|
disabled ? colordisabled : color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user