From 700c7753c3d2096741aeefa9718506fb8a3196a9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 31 Jul 2017 14:20:12 +0300 Subject: [PATCH] Applied suggestions --- osu.Game/Screens/Select/SongSelect.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 94740c0216..fd314e1559 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -129,11 +129,10 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }); - Add(new ActionContainer + Add(new ResetScrollContainer(() => carousel.ScrollToSelected()) { RelativeSizeAxes = Axes.Y, Width = 250, - OnHoverAction = () => carousel.ScrollToSelected(), }); if (ShowFooter) @@ -416,13 +415,18 @@ namespace osu.Game.Screens.Select return base.OnKeyDown(state, args); } - private class ActionContainer : Container + private class ResetScrollContainer : Container { - public Action OnHoverAction; + private readonly Action onHoverAction; + + public ResetScrollContainer(Action onHoverAction) + { + this.onHoverAction = onHoverAction; + } protected override bool OnHover(InputState state) { - OnHoverAction?.Invoke(); + onHoverAction?.Invoke(); return base.OnHover(state); } }