mirror of https://github.com/ppy/osu
Avoid performing eager selection constantly on adding ranges of new children
This commit is contained in:
parent
0a978c6131
commit
f3b24b9bb5
|
@ -95,7 +95,7 @@ private void loadBeatmapSets(IEnumerable<BeatmapSetInfo> beatmapSets)
|
|||
{
|
||||
CarouselRoot newRoot = new CarouselRoot(this);
|
||||
|
||||
beatmapSets.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild);
|
||||
newRoot.AddChildren(beatmapSets.Select(createCarouselSet).Where(g => g != null));
|
||||
|
||||
root = newRoot;
|
||||
if (selectedBeatmapSet != null && !beatmapSets.Contains(selectedBeatmapSet.BeatmapSet))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Screens.Select.Carousel
|
||||
|
@ -54,6 +55,14 @@ public override void RemoveChild(CarouselItem i)
|
|||
updateSelectedIndex();
|
||||
}
|
||||
|
||||
public void AddChildren(IEnumerable<CarouselItem> items)
|
||||
{
|
||||
foreach (var i in items)
|
||||
base.AddChild(i);
|
||||
|
||||
attemptSelection();
|
||||
}
|
||||
|
||||
public override void AddChild(CarouselItem i)
|
||||
{
|
||||
base.AddChild(i);
|
||||
|
|
Loading…
Reference in New Issue