mirror of https://github.com/ppy/osu
Fix changes to beatmap sets being undone on switching sort mode
This commit is contained in:
parent
80ec18d117
commit
b9795eb3d4
|
@ -78,7 +78,7 @@ public partial class BeatmapCarousel : CompositeDrawable, IKeyBindingHandler<Glo
|
||||||
|
|
||||||
private CarouselBeatmapSet? selectedBeatmapSet;
|
private CarouselBeatmapSet? selectedBeatmapSet;
|
||||||
|
|
||||||
private IEnumerable<BeatmapSetInfo> originalBeatmapSetsDetached = Enumerable.Empty<BeatmapSetInfo>();
|
private List<BeatmapSetInfo> originalBeatmapSetsDetached = new List<BeatmapSetInfo>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised when the <see cref="SelectedBeatmapInfo"/> is changed.
|
/// Raised when the <see cref="SelectedBeatmapInfo"/> is changed.
|
||||||
|
@ -381,6 +381,8 @@ private void removeBeatmapSet(Guid beatmapSetID) => Schedule(() =>
|
||||||
if (!root.BeatmapSetsByID.TryGetValue(beatmapSetID, out var existingSets))
|
if (!root.BeatmapSetsByID.TryGetValue(beatmapSetID, out var existingSets))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
originalBeatmapSetsDetached.RemoveAll(set => set.ID == beatmapSetID);
|
||||||
|
|
||||||
foreach (var set in existingSets)
|
foreach (var set in existingSets)
|
||||||
{
|
{
|
||||||
foreach (var beatmap in set.Beatmaps)
|
foreach (var beatmap in set.Beatmaps)
|
||||||
|
@ -402,6 +404,9 @@ public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
||||||
{
|
{
|
||||||
Guid? previouslySelectedID = null;
|
Guid? previouslySelectedID = null;
|
||||||
|
|
||||||
|
originalBeatmapSetsDetached.RemoveAll(set => set.ID == beatmapSet.ID);
|
||||||
|
originalBeatmapSetsDetached.Add(beatmapSet.Detach());
|
||||||
|
|
||||||
// If the selected beatmap is about to be removed, store its ID so it can be re-selected if required
|
// If the selected beatmap is about to be removed, store its ID so it can be re-selected if required
|
||||||
if (selectedBeatmapSet?.BeatmapSet.ID == beatmapSet.ID)
|
if (selectedBeatmapSet?.BeatmapSet.ID == beatmapSet.ID)
|
||||||
previouslySelectedID = selectedBeatmap?.BeatmapInfo.ID;
|
previouslySelectedID = selectedBeatmap?.BeatmapInfo.ID;
|
||||||
|
|
Loading…
Reference in New Issue