mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +08:00
Improve performance with large numbers of panels visible
This commit is contained in:
parent
c02ce16f47
commit
5d7413f19c
@ -483,11 +483,11 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
DrawableCarouselItem item = Items[i];
|
||||
|
||||
if (!item.Item.Visible) continue;
|
||||
|
||||
// Only add if we're not already part of the content.
|
||||
if (!scrollableContent.Contains(item))
|
||||
{
|
||||
if (!item.Item.Visible) continue;
|
||||
|
||||
// Makes sure headers are always _below_ items,
|
||||
// and depth flows downward.
|
||||
item.Depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0);
|
||||
|
@ -27,9 +27,19 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private CarouselItem lastSelected;
|
||||
|
||||
/// <summary>
|
||||
/// To avoid overhead during filter operations, we don't attempt any selections until after all
|
||||
/// children have been filtered. This bool will be true during the base <see cref="Filter(FilterCriteria)"/>
|
||||
/// operation.
|
||||
/// </summary>
|
||||
private bool filteringChildren;
|
||||
|
||||
public override void Filter(FilterCriteria criteria)
|
||||
{
|
||||
filteringChildren = true;
|
||||
base.Filter(criteria);
|
||||
filteringChildren = false;
|
||||
|
||||
attemptSelection();
|
||||
}
|
||||
|
||||
@ -64,6 +74,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private void attemptSelection()
|
||||
{
|
||||
if (filteringChildren) return;
|
||||
|
||||
// we only perform eager selection if we are a currently selected group.
|
||||
if (State != CarouselItemState.Selected) return;
|
||||
|
||||
|
@ -33,7 +33,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
if (InternalChildren != null)
|
||||
foreach (var c in InternalChildren)
|
||||
items.AddRange(c.Drawables);
|
||||
// if (!c.Filtered) <- potential optimisation at the cost of no fade out animations.
|
||||
items.AddRange(c.Drawables);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user