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

Merge pull request #25182 from peppy/song-select-scroll-improvemets

Improve mouse interactions at song select
This commit is contained in:
Bartłomiej Dach 2023-10-24 08:26:20 +02:00 committed by GitHub
commit 05d7516479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -1197,6 +1197,8 @@ namespace osu.Game.Screens.Select
{
private bool rightMouseScrollBlocked;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public CarouselScrollContainer()
{
// size is determined by the carousel itself, due to not all content necessarily being loaded.

View File

@ -171,11 +171,6 @@ namespace osu.Game.Screens.Select
AddRangeInternal(new Drawable[]
{
new ResetScrollContainer(() => Carousel.ScrollToSelected())
{
RelativeSizeAxes = Axes.Y,
Width = 250,
},
new VerticalMaskingContainer
{
Children = new Drawable[]
@ -243,6 +238,10 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Top = left_area_padding },
Children = new Drawable[]
{
new LeftSideInteractionContainer(() => Carousel.ScrollToSelected())
{
RelativeSizeAxes = Axes.Both,
},
beatmapInfoWedge = new BeatmapInfoWedge
{
Height = WEDGE_HEIGHT,
@ -1017,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);
}
}