1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +08:00

Avoid multiple access to selectedBeatmap during y position computation

This commit is contained in:
Dean Herbert 2017-12-15 00:23:39 +09:00
parent 2e3332e3fe
commit 192ceb5465

View File

@ -387,6 +387,8 @@ namespace osu.Game.Screens.Select
float lastSetY = 0;
var selected = selectedBeatmap;
foreach (DrawableCarouselItem d in Items)
{
switch (d)
@ -398,7 +400,7 @@ namespace osu.Game.Screens.Select
case DrawableCarouselBeatmap beatmap:
beatmap.MoveToX(beatmap.Item.State == CarouselItemState.Selected ? -50 : 0, 500, Easing.OutExpo);
if (beatmap.Item == selectedBeatmap)
if (beatmap.Item == selected)
selectedY = currentY + beatmap.DrawHeight / 2 - DrawHeight / 2;
// on first display we want to begin hidden under our group's header.