From cfd73cc900d5190ea2a9db291eb1ac22072f9cb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jun 2025 16:33:59 +0900 Subject: [PATCH] Add back scrollbar padding in new beatmap carousel Closes https://github.com/ppy/osu/issues/33447. Implementation copied from previous carousel. --- osu.Game/Graphics/Carousel/Carousel.cs | 23 ++++++++++++++++++++ osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 3 +++ 2 files changed, 26 insertions(+) diff --git a/osu.Game/Graphics/Carousel/Carousel.cs b/osu.Game/Graphics/Carousel/Carousel.cs index 0eac894dd4..94e864d71d 100644 --- a/osu.Game/Graphics/Carousel/Carousel.cs +++ b/osu.Game/Graphics/Carousel/Carousel.cs @@ -1009,6 +1009,29 @@ namespace osu.Game.Graphics.Carousel d.Y = (float)(((ICarouselPanel)d).DrawYPosition + scrollableExtent); } + #region Scrollbar padding + + public float ScrollbarPaddingTop { get; set; } = 5; + public float ScrollbarPaddingBottom { get; set; } = 5; + + protected override float ToScrollbarPosition(double scrollPosition) + { + if (Precision.AlmostEquals(0, ScrollableExtent)) + return 0; + + return (float)(ScrollbarPaddingTop + (ScrollbarMovementExtent - (ScrollbarPaddingTop + ScrollbarPaddingBottom)) * (scrollPosition / ScrollableExtent)); + } + + protected override float FromScrollbarPosition(float scrollbarPosition) + { + if (Precision.AlmostEquals(0, ScrollbarMovementExtent)) + return 0; + + return (float)(ScrollableExtent * ((scrollbarPosition - ScrollbarPaddingTop) / (ScrollbarMovementExtent - (ScrollbarPaddingTop + ScrollbarPaddingBottom)))); + } + + #endregion + #region Absolute scrolling private bool absoluteScrolling; diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index d11184f138..f580a3bc88 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -91,6 +91,9 @@ namespace osu.Game.Screens.SelectV2 DebounceDelay = 100; DistanceOffscreenToPreload = 100; + // Account for the osu! logo being in the way. + Scroll.ScrollbarPaddingBottom = 70; + Filters = new ICarouselFilter[] { matching = new BeatmapCarouselFilterMatching(() => Criteria!),