mirror of
https://github.com/ppy/osu.git
synced 2026-05-22 23:00:52 +08:00
Fix single filtered selection not being reselected after being filtered away
Closes https://github.com/ppy/osu/issues/35003. Bit dodgy to use `CurrentSelectionItem` for this. Ideally I would use the global `Beatmap.IsDefault`, but I kind of don't want to violate the rule that `BeatmapCarousel` shouldn't have direct access to the global beatmap. And this seems to work, so... maybe fine to use until it doesn't?
This commit is contained in:
@@ -561,8 +561,19 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
var beatmaps = items.Select(i => i.Model).OfType<GroupedBeatmap>();
|
||||
|
||||
if (beatmaps.Any(b => b.Equals(CurrentSelection as GroupedBeatmap)))
|
||||
// do not request recommended selection if the user already had selected a difficulty within the single filtered beatmap set,
|
||||
// as it could change the difficulty that will be selected
|
||||
var preexistingSelection = beatmaps.FirstOrDefault(b => b.Equals(CurrentSelection as GroupedBeatmap));
|
||||
|
||||
if (preexistingSelection != null)
|
||||
{
|
||||
// the selection might not have an item associated with it, if it was fully filtered away previously
|
||||
// in this case, request to reselect it
|
||||
if (CurrentSelectionItem == null)
|
||||
RequestSelection(preexistingSelection);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RequestRecommendedSelection(beatmaps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user