Skip to content

Commit 7a12a7c

Browse files
authored
Merge pull request #33628 from peppy/ssv2-add-back-scrollbar-padding
Add back scrollbar padding in new beatmap carousel
2 parents 932ba3d + cfd73cc commit 7a12a7c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

osu.Game/Graphics/Carousel/Carousel.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,29 @@ protected override void ApplyCurrentToContent()
10091009
d.Y = (float)(((ICarouselPanel)d).DrawYPosition + scrollableExtent);
10101010
}
10111011

1012+
#region Scrollbar padding
1013+
1014+
public float ScrollbarPaddingTop { get; set; } = 5;
1015+
public float ScrollbarPaddingBottom { get; set; } = 5;
1016+
1017+
protected override float ToScrollbarPosition(double scrollPosition)
1018+
{
1019+
if (Precision.AlmostEquals(0, ScrollableExtent))
1020+
return 0;
1021+
1022+
return (float)(ScrollbarPaddingTop + (ScrollbarMovementExtent - (ScrollbarPaddingTop + ScrollbarPaddingBottom)) * (scrollPosition / ScrollableExtent));
1023+
}
1024+
1025+
protected override float FromScrollbarPosition(float scrollbarPosition)
1026+
{
1027+
if (Precision.AlmostEquals(0, ScrollbarMovementExtent))
1028+
return 0;
1029+
1030+
return (float)(ScrollableExtent * ((scrollbarPosition - ScrollbarPaddingTop) / (ScrollbarMovementExtent - (ScrollbarPaddingTop + ScrollbarPaddingBottom))));
1031+
}
1032+
1033+
#endregion
1034+
10121035
#region Absolute scrolling
10131036

10141037
private bool absoluteScrolling;

osu.Game/Screens/SelectV2/BeatmapCarousel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public BeatmapCarousel()
9191
DebounceDelay = 100;
9292
DistanceOffscreenToPreload = 100;
9393

94+
// Account for the osu! logo being in the way.
95+
Scroll.ScrollbarPaddingBottom = 70;
96+
9497
Filters = new ICarouselFilter[]
9598
{
9699
matching = new BeatmapCarouselFilterMatching(() => Criteria!),

0 commit comments

Comments
 (0)