From e3cd0ef20045dfd16874760d9215b1515878614e Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Fri, 13 Apr 2018 11:09:49 +0200 Subject: [PATCH 1/3] Add right click scrolling in song select (and its option) --- osu.Game/Configuration/OsuConfigManager.cs | 5 +++- .../Sections/Gameplay/SongSelectSettings.cs | 5 ++++ osu.Game/Screens/Select/BeatmapCarousel.cs | 29 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 70260b349e..a3025a65f4 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -84,6 +84,8 @@ namespace osu.Game.Configuration Set(OsuSetting.Version, string.Empty); Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); + + Set(OsuSetting.SelectScrollRightClick, false); } public OsuConfigManager(Storage storage) : base(storage) @@ -128,6 +130,7 @@ namespace osu.Game.Configuration ShowConvertedBeatmaps, SpeedChangeVisualisation, Skin, - ScreenshotFormat + ScreenshotFormat, + SelectScrollRightClick } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs index 4bbd87c7e6..e8d65a1ed3 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs @@ -17,6 +17,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { + new SettingsCheckbox + { + LabelText = "Right click to scroll", + Bindable = config.GetBindable(OsuSetting.SelectScrollRightClick), + }, new SettingsCheckbox { LabelText = "Show converted beatmaps", diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 15f4d5cf96..5c3518b46c 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -97,6 +97,9 @@ namespace osu.Game.Screens.Select private readonly Container scrollableContent; + + public Bindable RightClickScrollingEnabled = new Bindable(); + public Bindable RandomAlgorithm = new Bindable(); private readonly List previouslyVisitedRandomSets = new List(); private readonly Stack randomSelectedBeatmaps = new Stack(); @@ -121,6 +124,7 @@ namespace osu.Game.Screens.Select private void load(OsuConfigManager config) { config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); + config.BindWith(OsuSetting.SelectScrollRightClick, RightClickScrollingEnabled); } public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) @@ -398,6 +402,31 @@ namespace osu.Game.Screens.Select return true; } + private bool rightClickScrolling = false; + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + bool result = base.OnMouseDown(state, args); + + if (RightClickScrollingEnabled.Value && !result && args.Button == MouseButton.Right) + { + rightClickScrolling = true; + return true; + } + + return result; + } + + protected override bool OnMouseMove(InputState state) + { + if (state.Mouse.Buttons.Contains(MouseButton.Right) && rightClickScrolling) + ScrollTo((state.Mouse.Position.Y / DrawHeight) * scrollableContent.Height); + else + rightClickScrolling = false; + + return base.OnMouseMove(state); + } + protected override void Update() { base.Update(); From 1a2b1d4c98f9d18485704e7349ae9f8626688a3b Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Fri, 13 Apr 2018 11:32:33 +0200 Subject: [PATCH 2/3] Use the already existent RightMouseScrollbar field --- osu.Game/Screens/Select/BeatmapCarousel.cs | 28 +++------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 5c3518b46c..793759908d 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -125,6 +125,9 @@ namespace osu.Game.Screens.Select { config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); config.BindWith(OsuSetting.SelectScrollRightClick, RightClickScrollingEnabled); + + RightClickScrollingEnabled.ValueChanged += v => RightMouseScrollbar = v; + RightClickScrollingEnabled.TriggerChange(); } public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) @@ -402,31 +405,6 @@ namespace osu.Game.Screens.Select return true; } - private bool rightClickScrolling = false; - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - bool result = base.OnMouseDown(state, args); - - if (RightClickScrollingEnabled.Value && !result && args.Button == MouseButton.Right) - { - rightClickScrolling = true; - return true; - } - - return result; - } - - protected override bool OnMouseMove(InputState state) - { - if (state.Mouse.Buttons.Contains(MouseButton.Right) && rightClickScrolling) - ScrollTo((state.Mouse.Position.Y / DrawHeight) * scrollableContent.Height); - else - rightClickScrolling = false; - - return base.OnMouseMove(state); - } - protected override void Update() { base.Update(); From e395a471125bc360035062e25a62856859cd1d0a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Apr 2018 19:26:54 +0900 Subject: [PATCH 3/3] Changes to naming and text --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- .../Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs | 4 ++-- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index ebc674c900..3efaa02a31 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -86,7 +86,7 @@ namespace osu.Game.Configuration Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); Set(OsuSetting.ScreenshotCaptureMenuCursor, false); - Set(OsuSetting.SelectScrollRightClick, false); + Set(OsuSetting.SongSelectRightMouseScroll, false); } public OsuConfigManager(Storage storage) : base(storage) @@ -133,6 +133,6 @@ namespace osu.Game.Configuration Skin, ScreenshotFormat, ScreenshotCaptureMenuCursor, - SelectScrollRightClick + SongSelectRightMouseScroll } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs index c3d8022a63..7893d76fb8 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs @@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { new SettingsCheckbox { - LabelText = "Right click to scroll", - Bindable = config.GetBindable(OsuSetting.SelectScrollRightClick), + LabelText = "Right mouse drag to absolute scroll", + Bindable = config.GetBindable(OsuSetting.SongSelectRightMouseScroll), }, new SettingsCheckbox { diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e88fec8106..3c9a14e1f4 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -125,7 +125,7 @@ namespace osu.Game.Screens.Select private void load(OsuConfigManager config) { config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); - config.BindWith(OsuSetting.SelectScrollRightClick, RightClickScrollingEnabled); + config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); RightClickScrollingEnabled.ValueChanged += v => RightMouseScrollbar = v; RightClickScrollingEnabled.TriggerChange();