Count direct children of text fields and buttons for mouseover.
This improves polish when mousing over prefix glyphs.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets
|
||||
@@ -240,7 +241,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var position = GetTextPosition(textSize, rb);
|
||||
|
||||
DrawBackground(rb, disabled, Depressed, Ui.MouseOverWidget == this, highlighted);
|
||||
var hover = Ui.MouseOverWidget == this || Children.Any(c => c == Ui.MouseOverWidget);
|
||||
DrawBackground(rb, disabled, Depressed, hover, highlighted);
|
||||
if (Contrast)
|
||||
font.DrawTextWithContrast(text, position + stateOffset,
|
||||
disabled ? colordisabled : color, bgDark, bgLight, 2);
|
||||
|
||||
@@ -567,7 +567,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
var disabled = IsDisabled();
|
||||
var state = disabled ? "textfield-disabled" :
|
||||
HasKeyboardFocus ? "textfield-focused" :
|
||||
Ui.MouseOverWidget == this ? "textfield-hover" :
|
||||
Ui.MouseOverWidget == this || Children.Any(c => c == Ui.MouseOverWidget) ? "textfield-hover" :
|
||||
"textfield";
|
||||
|
||||
WidgetUtils.DrawPanel(state,
|
||||
|
||||
Reference in New Issue
Block a user