From 649951198e800e23b46292f389f1271d899086f6 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 15 Oct 2019 14:47:48 -0700 Subject: [PATCH 1/4] Make most textbox carets movable --- osu.Game/Graphics/UserInterface/SearchTextBox.cs | 2 -- osu.Game/Screens/Select/FilterControl.cs | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index c3efe2ed45..e2b0e1b425 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -14,8 +14,6 @@ namespace osu.Game.Graphics.UserInterface { protected virtual bool AllowCommit => false; - public override bool HandleLeftRightArrows => false; - public SearchTextBox() { Height = 35; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 8755c3fda6..2c878f8d90 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select return criteria; } - private readonly SearchTextBox searchTextBox; + private readonly SongSelectTextBox searchTextBox; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos); @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.TopRight, Children = new Drawable[] { - searchTextBox = new SearchTextBox { RelativeSizeAxes = Axes.X }, + searchTextBox = new SongSelectTextBox { RelativeSizeAxes = Axes.X }, new Box { RelativeSizeAxes = Axes.X, @@ -170,5 +170,10 @@ namespace osu.Game.Screens.Select } private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria()); + + private class SongSelectTextBox : SearchTextBox + { + public override bool HandleLeftRightArrows => false; + } } } From e5b50b5e1fda974c7e47ec5be852ff0ec98bcf63 Mon Sep 17 00:00:00 2001 From: Joehu Date: Thu, 17 Oct 2019 13:54:36 -0700 Subject: [PATCH 2/4] Fix slider bar regression when using arrows --- osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs | 10 ++++++++++ osu.Game/Overlays/SettingsPanel.cs | 4 ++-- osu.Game/Screens/Select/FilterControl.cs | 9 ++------- 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs diff --git a/osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs new file mode 100644 index 0000000000..0654746a6e --- /dev/null +++ b/osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Graphics.UserInterface +{ + public class FixedSearchTextBox : SearchTextBox + { + public override bool HandleLeftRightArrows => false; + } +} diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index 37e7b62483..119b9a2b8c 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays protected SettingsSectionsContainer SectionsContainer; - private SearchTextBox searchTextBox; + private FixedSearchTextBox searchTextBox; /// /// Provide a source for the toolbar height. @@ -80,7 +80,7 @@ namespace osu.Game.Overlays Masking = true, RelativeSizeAxes = Axes.Both, ExpandableHeader = CreateHeader(), - FixedHeader = searchTextBox = new SearchTextBox + FixedHeader = searchTextBox = new FixedSearchTextBox { RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 2c878f8d90..7aca11da2f 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select return criteria; } - private readonly SongSelectTextBox searchTextBox; + private readonly FixedSearchTextBox searchTextBox; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos); @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.TopRight, Children = new Drawable[] { - searchTextBox = new SongSelectTextBox { RelativeSizeAxes = Axes.X }, + searchTextBox = new FixedSearchTextBox { RelativeSizeAxes = Axes.X }, new Box { RelativeSizeAxes = Axes.X, @@ -170,10 +170,5 @@ namespace osu.Game.Screens.Select } private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria()); - - private class SongSelectTextBox : SearchTextBox - { - public override bool HandleLeftRightArrows => false; - } } } From f7924d3bad6ce574c1967ba5a956915f8e9be56e Mon Sep 17 00:00:00 2001 From: Joehu Date: Mon, 21 Oct 2019 16:00:09 -0700 Subject: [PATCH 3/4] Rename "FixedSearchTextBox" to "SeekLimitedSearchTextBox" --- .../{FixedSearchTextBox.cs => SeekLimitedSearchTextBox.cs} | 2 +- osu.Game/Overlays/SettingsPanel.cs | 4 ++-- osu.Game/Screens/Select/FilterControl.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename osu.Game/Graphics/UserInterface/{FixedSearchTextBox.cs => SeekLimitedSearchTextBox.cs} (82%) diff --git a/osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs similarity index 82% rename from osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs rename to osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs index 0654746a6e..6cd14c3263 100644 --- a/osu.Game/Graphics/UserInterface/FixedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs @@ -3,7 +3,7 @@ namespace osu.Game.Graphics.UserInterface { - public class FixedSearchTextBox : SearchTextBox + public class SeekLimitedSearchTextBox : SearchTextBox { public override bool HandleLeftRightArrows => false; } diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index 119b9a2b8c..d028664fe0 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays protected SettingsSectionsContainer SectionsContainer; - private FixedSearchTextBox searchTextBox; + private SeekLimitedSearchTextBox searchTextBox; /// /// Provide a source for the toolbar height. @@ -80,7 +80,7 @@ namespace osu.Game.Overlays Masking = true, RelativeSizeAxes = Axes.Both, ExpandableHeader = CreateHeader(), - FixedHeader = searchTextBox = new FixedSearchTextBox + FixedHeader = searchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7aca11da2f..5b81303788 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select return criteria; } - private readonly FixedSearchTextBox searchTextBox; + private readonly SeekLimitedSearchTextBox searchTextBox; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos); @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.TopRight, Children = new Drawable[] { - searchTextBox = new FixedSearchTextBox { RelativeSizeAxes = Axes.X }, + searchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, new Box { RelativeSizeAxes = Axes.X, From 5d0d83b6bf8b6a8546e8df4b0313199f439ca138 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Oct 2019 15:04:10 +0900 Subject: [PATCH 4/4] Add basic xmldoc --- osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs index 6cd14c3263..6a9e8a5b8c 100644 --- a/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs @@ -3,6 +3,9 @@ namespace osu.Game.Graphics.UserInterface { + /// + /// A which does not handle left/right arrow keys for seeking. + /// public class SeekLimitedSearchTextBox : SearchTextBox { public override bool HandleLeftRightArrows => false;