From 9cc90a51df7aa2a0043690ff873ed836741993b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Feb 2025 13:32:11 +0900 Subject: [PATCH] Adjust xmldoc and avoid LINQ overheads --- osu.Game/Screens/SelectV2/Carousel.cs | 7 +++---- osu.Game/Screens/SelectV2/CarouselItem.cs | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/SelectV2/Carousel.cs b/osu.Game/Screens/SelectV2/Carousel.cs index 5dc8d80476..07d9c988f5 100644 --- a/osu.Game/Screens/SelectV2/Carousel.cs +++ b/osu.Game/Screens/SelectV2/Carousel.cs @@ -550,8 +550,7 @@ namespace osu.Game.Screens.SelectV2 updateDisplayedRange(range); } - double selectedYPos = currentSelection?.CarouselItem?.CarouselYPosition ?? 0; - double maximumDistanceFromSelection = scroll.Panels.Select(p => Math.Abs(((ICarouselPanel)p).DrawYPosition - selectedYPos)).DefaultIfEmpty().Max(); + double selectedYPos = currentSelection.CarouselItem?.CarouselYPosition ?? 0; foreach (var panel in scroll.Panels) { @@ -561,8 +560,8 @@ namespace osu.Game.Screens.SelectV2 if (c.Item == null) continue; - float normalisedDepth = (float)(Math.Abs(selectedYPos - c.DrawYPosition) / maximumDistanceFromSelection); - scroll.Panels.ChangeChildDepth(panel, normalisedDepth + c.Item.DepthLayer); + float normalisedDepth = (float)(Math.Abs(selectedYPos - c.DrawYPosition) / DrawHeight); + scroll.Panels.ChangeChildDepth(panel, c.Item.DepthLayer + normalisedDepth); if (c.DrawYPosition != c.Item.CarouselYPosition) c.DrawYPosition = Interpolation.DampContinuously(c.DrawYPosition, c.Item.CarouselYPosition, 50, Time.Elapsed); diff --git a/osu.Game/Screens/SelectV2/CarouselItem.cs b/osu.Game/Screens/SelectV2/CarouselItem.cs index e497c3890c..0ac8180028 100644 --- a/osu.Game/Screens/SelectV2/CarouselItem.cs +++ b/osu.Game/Screens/SelectV2/CarouselItem.cs @@ -30,10 +30,9 @@ namespace osu.Game.Screens.SelectV2 public float DrawHeight { get; set; } = DEFAULT_HEIGHT; /// - /// A number that defines the layer which this should be placed on depth-wise. - /// The higher the number, the farther the panel associated with this item is taken to the background. + /// Defines the display depth relative to other s. /// - public int DepthLayer { get; set; } = 0; + public int DepthLayer { get; set; } /// /// Whether this item is visible or hidden.