Fix hide selection, add test

This commit is contained in:
David Zhao
2019-05-28 19:15:29 +09:00
parent 436760de96
commit 1a871af552
2 changed files with 16 additions and 1 deletions

View File

@ -158,6 +158,9 @@ namespace osu.Game.Screens.Select
var newSet = createCarouselSet(beatmapSet);
// Since we're about to remove the selected beatmap, store its ID so we can go back if needed.
var previouslySelectedID = selectedBeatmap?.Beatmap.ID;
if (existingSet != null)
root.RemoveChild(existingSet);
@ -173,7 +176,7 @@ namespace osu.Game.Screens.Select
//check if we can/need to maintain our current selection.
if (hadSelection)
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == selectedBeatmap?.Beatmap.ID) ?? newSet);
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet);
itemsCache.Invalidate();
Schedule(() => BeatmapSetsChanged?.Invoke());