mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 16:03:01 +08:00
Simplify and comment
This commit is contained in:
parent
63a1686dfb
commit
b475316a4e
@ -632,7 +632,11 @@ namespace osu.Game.Screens.Select
|
|||||||
case DrawableCarouselBeatmap beatmap:
|
case DrawableCarouselBeatmap beatmap:
|
||||||
{
|
{
|
||||||
if (beatmap.Item.State.Value == CarouselItemState.Selected)
|
if (beatmap.Item.State.Value == CarouselItemState.Selected)
|
||||||
scrollTarget = currentY + beatmap.DrawHeight / 2 - (Parent.DrawHeight / 2 - Parent.Padding.Top);
|
// scroll position at currentY makes the set panel appear at the very top of the carousel in screen space
|
||||||
|
// move down by half of parent height (which is the height of the carousel's visible extent, including semi-transparent areas)
|
||||||
|
// then reapply parent's padding from the top by adding it
|
||||||
|
// and finally add half of the panel's own height to achieve vertical centering of the panel itself
|
||||||
|
scrollTarget = currentY - Parent.DrawHeight / 2 + Parent.Padding.Top + beatmap.DrawHeight / 2;
|
||||||
|
|
||||||
void performMove(float y, float? startY = null)
|
void performMove(float y, float? startY = null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user