mirror of
https://github.com/ppy/osu
synced 2025-03-05 02:49:30 +00:00
Better SearchTextBox focus handling.
This commit is contained in:
parent
2ffab66184
commit
ddea76927f
@ -61,13 +61,13 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
searchTextBox.GrabFocus = false;
|
||||
searchTextBox.HoldFocus = false;
|
||||
searchTextBox.TriggerFocusLost();
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
searchTextBox.GrabFocus = true;
|
||||
searchTextBox.HoldFocus = true;
|
||||
}
|
||||
|
||||
private class TabItem : ClickableContainer
|
||||
|
@ -17,7 +17,18 @@ namespace osu.Game.Screens.Select
|
||||
protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
|
||||
protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);
|
||||
public Action Exit;
|
||||
public bool GrabFocus = false;
|
||||
|
||||
private bool focus;
|
||||
public bool HoldFocus
|
||||
{
|
||||
get { return focus; }
|
||||
set
|
||||
{
|
||||
focus = value;
|
||||
if (!focus)
|
||||
TriggerFocusLost();
|
||||
}
|
||||
}
|
||||
|
||||
private SpriteText placeholder;
|
||||
|
||||
@ -64,8 +75,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
if (GrabFocus && !HasFocus && IsVisible)
|
||||
TriggerFocus();
|
||||
if (HoldFocus) RequestFocus();
|
||||
base.Update();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user