mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09: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];
|
DrawableCarouselItem item = Items[i];
|
||||||
|
|
||||||
|
if (!item.Item.Visible) continue;
|
||||||
|
|
||||||
// Only add if we're not already part of the content.
|
// Only add if we're not already part of the content.
|
||||||
if (!scrollableContent.Contains(item))
|
if (!scrollableContent.Contains(item))
|
||||||
{
|
{
|
||||||
if (!item.Item.Visible) continue;
|
|
||||||
|
|
||||||
// Makes sure headers are always _below_ items,
|
// Makes sure headers are always _below_ items,
|
||||||
// and depth flows downward.
|
// and depth flows downward.
|
||||||
item.Depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0);
|
item.Depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0);
|
||||||
|
@ -27,9 +27,19 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
private CarouselItem lastSelected;
|
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)
|
public override void Filter(FilterCriteria criteria)
|
||||||
{
|
{
|
||||||
|
filteringChildren = true;
|
||||||
base.Filter(criteria);
|
base.Filter(criteria);
|
||||||
|
filteringChildren = false;
|
||||||
|
|
||||||
attemptSelection();
|
attemptSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +74,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
private void attemptSelection()
|
private void attemptSelection()
|
||||||
{
|
{
|
||||||
|
if (filteringChildren) return;
|
||||||
|
|
||||||
// we only perform eager selection if we are a currently selected group.
|
// we only perform eager selection if we are a currently selected group.
|
||||||
if (State != CarouselItemState.Selected) return;
|
if (State != CarouselItemState.Selected) return;
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
if (InternalChildren != null)
|
if (InternalChildren != null)
|
||||||
foreach (var c in InternalChildren)
|
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;
|
return items;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user