1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:33:21 +08:00

Block scroll and click operations on the left side of song select

This commit is contained in:
Dean Herbert 2023-10-24 14:51:40 +09:00
parent 0ae0b0c353
commit 1274829193
No known key found for this signature in database

View File

@ -238,7 +238,7 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Top = left_area_padding },
Children = new Drawable[]
{
new ResetScrollContainer(() => Carousel.ScrollToSelected())
new LeftSideInteractionContainer(() => Carousel.ScrollToSelected())
{
RelativeSizeAxes = Axes.Both,
},
@ -1016,18 +1016,25 @@ namespace osu.Game.Screens.Select
}
}
private partial class ResetScrollContainer : Container
/// <summary>
/// Handles mouse interactions required when moving away from the carousel.
/// </summary>
private partial class LeftSideInteractionContainer : Container
{
private readonly Action? onHoverAction;
private readonly Action? resetCarouselPosition;
public ResetScrollContainer(Action onHoverAction)
public LeftSideInteractionContainer(Action resetCarouselPosition)
{
this.onHoverAction = onHoverAction;
this.resetCarouselPosition = resetCarouselPosition;
}
protected override bool OnScroll(ScrollEvent e) => true;
protected override bool OnMouseDown(MouseDownEvent e) => true;
protected override bool OnHover(HoverEvent e)
{
onHoverAction?.Invoke();
resetCarouselPosition?.Invoke();
return base.OnHover(e);
}
}