-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ordering certain carousel panels behind others #31802
Conversation
@@ -29,6 +29,12 @@ public sealed class CarouselItem : IComparable<CarouselItem> | |||
/// </summary> | |||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should mention that this is relative to other panels, rather than "to the background" (because it doesn't make too much sense when they are never really approaching any background).
@@ -550,6 +550,9 @@ protected override void Update() | |||
updateDisplayedRange(range); | |||
} | |||
|
|||
double selectedYPos = currentSelection?.CarouselItem?.CarouselYPosition ?? 0; | |||
double maximumDistanceFromSelection = scroll.Panels.Select(p => Math.Abs(((ICarouselPanel)p).DrawYPosition - selectedYPos)).DefaultIfEmpty().Max(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't run linq in Update
as a rule. Why can't this just be scroll.Panels[^1]
?
@frenzibyte I've applied fixes for the issues I pointed out. Please double-check everything still works as you expect. |
Seems to work fine, using |
There is no appropriate example to show where this helps currently, but this becomes more apparent during beatmap carousel transitions where beatmap difficulty panels may temporarily overlap with a beatmap set panel during transition, and at that point the difficulty panel should logically always be behind it. This is what this change aims to achieve.
I was considering to approach this with a virtual method computing the final depth value of each item, but I realised 99% of the logic is strongly attached to the internals of
Carousel
, and I was between making the virtual method accept many parameters to not deal with those internals or expose them toBeatmapCarousel
, both of which sound bad quality-wise.