Fix beatmap carousel interactions with deletion when not yet displayed

This commit is contained in:
Dean Herbert 2017-10-18 18:36:35 +09:00
parent 668f68dd63
commit a85de09c0f

View File

@ -33,10 +33,7 @@ namespace osu.Game.Screens.Select
public IEnumerable<BeatmapSetInfo> Beatmaps public IEnumerable<BeatmapSetInfo> Beatmaps
{ {
get get { return groups.Select(g => g.BeatmapSet); }
{
return groups.Select(g => g.BeatmapSet);
}
set set
{ {
@ -100,12 +97,10 @@ namespace osu.Game.Screens.Select
public void AddBeatmap(BeatmapSetInfo beatmapSet) public void AddBeatmap(BeatmapSetInfo beatmapSet)
{ {
var group = createGroup(beatmapSet); Schedule(() =>
//for the time being, let's completely load the difficulty panels in the background.
//this likely won't scale so well, but allows us to completely async the loading flow.
Schedule(delegate
{ {
var group = createGroup(beatmapSet);
addGroup(group); addGroup(group);
computeYPositions(); computeYPositions();
if (selectedGroup == null) if (selectedGroup == null)
@ -113,7 +108,10 @@ namespace osu.Game.Screens.Select
}); });
} }
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID)); public void RemoveBeatmap(BeatmapSetInfo beatmapSet)
{
Schedule(() => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID)));
}
internal void UpdateBeatmap(BeatmapInfo beatmap) internal void UpdateBeatmap(BeatmapInfo beatmap)
{ {
@ -519,7 +517,7 @@ namespace osu.Game.Screens.Select
float drawHeight = DrawHeight; float drawHeight = DrawHeight;
// Remove all panels that should no longer be on-screen // Remove all panels that should no longer be on-screen
scrollableContent.RemoveAll(delegate (Panel p) scrollableContent.RemoveAll(delegate(Panel p)
{ {
float panelPosY = p.Position.Y; float panelPosY = p.Position.Y;
bool remove = panelPosY < Current - p.DrawHeight || panelPosY > Current + drawHeight || !p.IsPresent; bool remove = panelPosY < Current - p.DrawHeight || panelPosY > Current + drawHeight || !p.IsPresent;