mirror of
https://github.com/ppy/osu
synced 2024-12-26 17:02:59 +00:00
Force beatmap listing overlay's textbox back on screen when a key is pressed
Not the cleanest solution, but works for now. Will eventually be replaced after the header is updated to reflect the latest designs (which keeps it on screen in all cases). Closes https://github.com/ppy/osu/issues/10703.
This commit is contained in:
parent
c8917d1236
commit
a2ef3aa21a
@ -32,6 +32,11 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Action SearchStarted;
|
public Action SearchStarted;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Any time the search text box receives key events (even while masked).
|
||||||
|
/// </summary>
|
||||||
|
public Action TypingStarted;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True when pagination has reached the end of available results.
|
/// True when pagination has reached the end of available results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -82,7 +87,10 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
Radius = 3,
|
Radius = 3,
|
||||||
Offset = new Vector2(0f, 1f),
|
Offset = new Vector2(0f, 1f),
|
||||||
},
|
},
|
||||||
Child = searchControl = new BeatmapListingSearchControl(),
|
Child = searchControl = new BeatmapListingSearchControl
|
||||||
|
{
|
||||||
|
TypingStarted = () => TypingStarted?.Invoke()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -19,6 +21,11 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
public class BeatmapListingSearchControl : CompositeDrawable
|
public class BeatmapListingSearchControl : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Any time the text box receives key events (even while masked).
|
||||||
|
/// </summary>
|
||||||
|
public Action TypingStarted;
|
||||||
|
|
||||||
public Bindable<string> Query => textBox.Current;
|
public Bindable<string> Query => textBox.Current;
|
||||||
|
|
||||||
public Bindable<RulesetInfo> Ruleset => modeFilter.Current;
|
public Bindable<RulesetInfo> Ruleset => modeFilter.Current;
|
||||||
@ -102,6 +109,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
textBox = new BeatmapSearchTextBox
|
textBox = new BeatmapSearchTextBox
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
TypingStarted = () => TypingStarted?.Invoke(),
|
||||||
},
|
},
|
||||||
new ReverseChildIDFillFlowContainer<Drawable>
|
new ReverseChildIDFillFlowContainer<Drawable>
|
||||||
{
|
{
|
||||||
@ -138,12 +146,23 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
private class BeatmapSearchTextBox : SearchTextBox
|
private class BeatmapSearchTextBox : SearchTextBox
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Any time the text box receives key events (even while masked).
|
||||||
|
/// </summary>
|
||||||
|
public Action TypingStarted;
|
||||||
|
|
||||||
protected override Color4 SelectionColour => Color4.Gray;
|
protected override Color4 SelectionColour => Color4.Gray;
|
||||||
|
|
||||||
public BeatmapSearchTextBox()
|
public BeatmapSearchTextBox()
|
||||||
{
|
{
|
||||||
PlaceholderText = @"type in keywords...";
|
PlaceholderText = @"type in keywords...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
TypingStarted?.Invoke();
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ namespace osu.Game.Overlays
|
|||||||
Header,
|
Header,
|
||||||
filterControl = new BeatmapListingFilterControl
|
filterControl = new BeatmapListingFilterControl
|
||||||
{
|
{
|
||||||
|
TypingStarted = onTypingStarted,
|
||||||
SearchStarted = onSearchStarted,
|
SearchStarted = onSearchStarted,
|
||||||
SearchFinished = onSearchFinished,
|
SearchFinished = onSearchFinished,
|
||||||
},
|
},
|
||||||
@ -102,6 +103,12 @@ namespace osu.Game.Overlays
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onTypingStarted()
|
||||||
|
{
|
||||||
|
// temporary until the textbox/header is updated to always stay on screen.
|
||||||
|
resultScrollContainer.ScrollToStart();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
base.OnFocus(e);
|
base.OnFocus(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user