1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 20:05:29 +08:00

Remove hotkeys handling from DeselectAllModsButton

This commit is contained in:
Cootz 2023-06-03 10:47:48 +03:00
parent 9d4ba5d64a
commit 69b640a185
2 changed files with 9 additions and 12 deletions

View File

@ -18,7 +18,6 @@ namespace osu.Game.Overlays.Mods
public partial class DeselectAllModsButton : ShearedButton, IKeyBindingHandler<GlobalAction>
{
private readonly Bindable<IReadOnlyList<Mod>> selectedMods = new Bindable<IReadOnlyList<Mod>>();
private readonly ShearedSearchTextBox searchTextBox;
public DeselectAllModsButton(ModSelectOverlay modSelectOverlay)
: base(ModSelectOverlay.BUTTON_WIDTH)
@ -26,8 +25,6 @@ namespace osu.Game.Overlays.Mods
Text = CommonStrings.DeselectAll;
Action = modSelectOverlay.DeselectAll;
searchTextBox = modSelectOverlay.SearchTextBox;
selectedMods.BindTo(modSelectOverlay.SelectedMods);
}
@ -45,7 +42,7 @@ namespace osu.Game.Overlays.Mods
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Repeat || e.Action != GlobalAction.DeselectAllMods || searchTextBox.HasFocus)
if (e.Repeat || e.Action != GlobalAction.DeselectAllMods)
return false;
TriggerClick();

View File

@ -66,17 +66,17 @@ namespace osu.Game.Overlays.Mods
public string SearchTerm
{
get => SearchTextBox.Current.Value;
get => searchTextBox.Current.Value;
set
{
if (SearchTextBox.Current.Value == value)
if (searchTextBox.Current.Value == value)
return;
SearchTextBox.Current.Value = value;
searchTextBox.Current.Value = value;
}
}
public ShearedSearchTextBox SearchTextBox { get; private set; } = null!;
private ShearedSearchTextBox searchTextBox = null!;
/// <summary>
/// Whether the total score multiplier calculated from the current selected set of mods should be shown.
@ -166,7 +166,7 @@ namespace osu.Game.Overlays.Mods
RelativeSizeAxes = Axes.X,
Height = ModsEffectDisplay.HEIGHT,
Padding = new MarginPadding { Horizontal = 100 },
Child = SearchTextBox = new ShearedSearchTextBox
Child = searchTextBox = new ShearedSearchTextBox
{
HoldFocus = false,
Width = 300
@ -249,7 +249,7 @@ namespace osu.Game.Overlays.Mods
base.Hide();
//We want to clear search for next user interaction with mod overlay
SearchTextBox.Current.Value = string.Empty;
searchTextBox.Current.Value = string.Empty;
}
private ModSettingChangeTracker? modSettingChangeTracker;
@ -289,7 +289,7 @@ namespace osu.Game.Overlays.Mods
customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true);
SearchTextBox.Current.BindValueChanged(query =>
searchTextBox.Current.BindValueChanged(query =>
{
foreach (var column in columnFlow.Columns)
column.SearchTerm = query.NewValue;
@ -789,7 +789,7 @@ namespace osu.Game.Overlays.Mods
if (!Active.Value)
RequestScroll?.Invoke(this);
//Kill focus on SearchTextBox
//Kill focus on searchTextBox
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
return true;