From e121b119be21d896b8754c43e5fdf3daf2433d0c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 29 Jul 2017 17:33:20 +0300 Subject: [PATCH] Added "scroll to" container --- osu.Game/Screens/Select/SongSelect.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bbd292870e..57e2183853 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select private BeatmapManager manager; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); + private readonly ActionContainer actionContainer; private readonly BeatmapCarousel carousel; private DialogOverlay dialogOverlay; @@ -129,6 +130,12 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }); + Add(actionContainer = new ActionContainer + { + RelativeSizeAxes = Axes.Y, + Width = 250, + OnHoverAction = () => carousel.ScrollToSelected(), + }); if (ShowFooter) { @@ -409,5 +416,16 @@ namespace osu.Game.Screens.Select return base.OnKeyDown(state, args); } + + private class ActionContainer : Container + { + public Action OnHoverAction; + + protected override bool OnHover(InputState state) + { + OnHoverAction?.Invoke(); + return base.OnHover(state); + } + } } }