From a4441fed30387b1e465c1d6e3fcafbdd2fdf784b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jan 2025 19:02:27 +0900 Subject: [PATCH] Add overlapping spacing support --- osu.Game/Screens/SelectV2/Carousel.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/SelectV2/Carousel.cs b/osu.Game/Screens/SelectV2/Carousel.cs index 12a86be7b94f..5080b2876341 100644 --- a/osu.Game/Screens/SelectV2/Carousel.cs +++ b/osu.Game/Screens/SelectV2/Carousel.cs @@ -48,6 +48,11 @@ public abstract partial class Carousel : CompositeDrawable /// public float DistanceOffscreenToPreload { get; set; } + /// + /// Vertical space between panel layout. Negative value can be used to create an overlapping effect. + /// + protected float SpacingBetweenPanels { get; set; } = -5; + /// /// When a new request arrives to change filtering, the number of milliseconds to wait before performing the filter. /// Regardless of any external debouncing, this is a safety measure to avoid triggering too many threaded operations. @@ -212,13 +217,12 @@ await Task.Run(async () => private async Task updateYPositions(IEnumerable carouselItems, CancellationToken cancellationToken) => await Task.Run(() => { - const float spacing = 10; float yPos = 0; foreach (var item in carouselItems) { item.CarouselYPosition = yPos; - yPos += item.DrawHeight + spacing; + yPos += item.DrawHeight + SpacingBetweenPanels; } }, cancellationToken).ConfigureAwait(false);