Skip to content

Commit

Permalink
Add overlapping spacing support
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jan 15, 2025
1 parent 4196b3d commit a4441fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions osu.Game/Screens/SelectV2/Carousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public abstract partial class Carousel<T> : CompositeDrawable
/// </summary>
public float DistanceOffscreenToPreload { get; set; }

/// <summary>
/// Vertical space between panel layout. Negative value can be used to create an overlapping effect.
/// </summary>
protected float SpacingBetweenPanels { get; set; } = -5;

/// <summary>
/// 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.
Expand Down Expand Up @@ -212,13 +217,12 @@ await Task.Run(async () =>

private async Task updateYPositions(IEnumerable<CarouselItem> 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);

Expand Down

0 comments on commit a4441fe

Please sign in to comment.