diff --git a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs index e4160cc0fa..55cb5fa5f9 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs @@ -66,7 +66,12 @@ namespace osu.Game.Screens.SelectV2 { starGroup = (int)Math.Floor(b.StarRating); var groupDefinition = new GroupDefinition($"{starGroup} - {++starGroup} *"); - var groupItem = new CarouselItem(groupDefinition) { DrawHeight = GroupPanel.HEIGHT }; + + var groupItem = new CarouselItem(groupDefinition) + { + DrawHeight = GroupPanel.HEIGHT, + DepthLayer = -2 + }; newItems.Add(groupItem); groupItems[groupDefinition] = new HashSet { groupItem }; @@ -95,7 +100,12 @@ namespace osu.Game.Screens.SelectV2 if (newBeatmapSet) { - var setItem = new CarouselItem(beatmap.BeatmapSet!) { DrawHeight = BeatmapSetPanel.HEIGHT }; + var setItem = new CarouselItem(beatmap.BeatmapSet!) + { + DrawHeight = BeatmapSetPanel.HEIGHT, + DepthLayer = -1 + }; + setItems[beatmap.BeatmapSet!] = new HashSet { setItem }; newItems.Insert(i, setItem); i++; diff --git a/osu.Game/Screens/SelectV2/Carousel.cs b/osu.Game/Screens/SelectV2/Carousel.cs index 3371e45453..1fd2f0a9b0 100644 --- a/osu.Game/Screens/SelectV2/Carousel.cs +++ b/osu.Game/Screens/SelectV2/Carousel.cs @@ -548,6 +548,8 @@ namespace osu.Game.Screens.SelectV2 updateDisplayedRange(range); } + double selectedYPos = currentSelection.CarouselItem?.CarouselYPosition ?? 0; + foreach (var panel in scroll.Panels) { var c = (ICarouselPanel)panel; @@ -556,8 +558,8 @@ namespace osu.Game.Screens.SelectV2 if (c.Item == null) continue; - double selectedYPos = currentSelection?.CarouselItem?.CarouselYPosition ?? 0; - scroll.Panels.ChangeChildDepth(panel, (float)Math.Abs(c.DrawYPosition - selectedYPos)); + 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 32be33e99a..0ac8180028 100644 --- a/osu.Game/Screens/SelectV2/CarouselItem.cs +++ b/osu.Game/Screens/SelectV2/CarouselItem.cs @@ -29,6 +29,11 @@ namespace osu.Game.Screens.SelectV2 /// public float DrawHeight { get; set; } = DEFAULT_HEIGHT; + /// + /// Defines the display depth relative to other s. + /// + public int DepthLayer { get; set; } + /// /// Whether this item is visible or hidden. ///