1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 20:23:06 +08:00

Adjust xmldoc and avoid LINQ overheads

This commit is contained in:
Dean Herbert 2025-02-06 13:32:11 +09:00
parent c370c75fe2
commit 9cc90a51df
No known key found for this signature in database
2 changed files with 5 additions and 7 deletions

View File

@ -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);

View File

@ -30,10 +30,9 @@ namespace osu.Game.Screens.SelectV2
public float DrawHeight { get; set; } = DEFAULT_HEIGHT;
/// <summary>
/// A number that defines the layer which this <see cref="CarouselItem"/> 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 <see cref="CarouselItem"/>s.
/// </summary>
public int DepthLayer { get; set; } = 0;
public int DepthLayer { get; set; }
/// <summary>
/// Whether this item is visible or hidden.