mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Better SearchTextBox focus handling.
This commit is contained in:
@ -61,13 +61,13 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
{
|
{
|
||||||
searchTextBox.GrabFocus = false;
|
searchTextBox.HoldFocus = false;
|
||||||
searchTextBox.TriggerFocusLost();
|
searchTextBox.TriggerFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public void Activate()
|
||||||
{
|
{
|
||||||
searchTextBox.GrabFocus = true;
|
searchTextBox.HoldFocus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TabItem : ClickableContainer
|
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 BackgroundUnfocused => new Color4(10, 10, 10, 255);
|
||||||
protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);
|
protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);
|
||||||
public Action Exit;
|
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;
|
private SpriteText placeholder;
|
||||||
|
|
||||||
@ -64,8 +75,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
if (GrabFocus && !HasFocus && IsVisible)
|
if (HoldFocus) RequestFocus();
|
||||||
TriggerFocus();
|
|
||||||
base.Update();
|
base.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user