Added "scroll to" container

This commit is contained in:
EVAST9919 2017-07-29 17:33:20 +03:00
parent 8458622c4d
commit e121b119be
1 changed files with 18 additions and 0 deletions

View File

@ -31,6 +31,7 @@ public abstract class SongSelect : OsuScreen
private BeatmapManager manager;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
private readonly ActionContainer actionContainer;
private readonly BeatmapCarousel carousel;
private DialogOverlay dialogOverlay;
@ -129,6 +130,12 @@ protected SongSelect()
Right = left_area_padding,
},
});
Add(actionContainer = new ActionContainer
{
RelativeSizeAxes = Axes.Y,
Width = 250,
OnHoverAction = () => carousel.ScrollToSelected(),
});
if (ShowFooter)
{
@ -409,5 +416,16 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
return base.OnKeyDown(state, args);
}
private class ActionContainer : Container
{
public Action OnHoverAction;
protected override bool OnHover(InputState state)
{
OnHoverAction?.Invoke();
return base.OnHover(state);
}
}
}
}