Add initial implementation of beatmap carousel no-results-placeholder

This commit is contained in:
Dean Herbert
2022-06-07 16:32:15 +09:00
parent df9174ec00
commit 0d32c94104
3 changed files with 170 additions and 1 deletions

View File

@ -97,6 +97,8 @@ namespace osu.Game.Screens.Select
protected readonly CarouselScrollContainer Scroll;
private readonly NoResultsPlaceholder noResultsPlaceholder;
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
// todo: only used for testing, maybe remove.
@ -170,7 +172,8 @@ namespace osu.Game.Screens.Select
Scroll = new CarouselScrollContainer
{
RelativeSizeAxes = Axes.Both,
}
},
noResultsPlaceholder = new NoResultsPlaceholder()
}
};
}
@ -648,8 +651,18 @@ namespace osu.Game.Screens.Select
// First we iterate over all non-filtered carousel items and populate their
// vertical position data.
if (revalidateItems)
{
updateYPositions();
if (visibleItems.Count == 0)
{
noResultsPlaceholder.Filter = activeCriteria;
noResultsPlaceholder.Show();
}
else
noResultsPlaceholder.Hide();
}
// if there is a pending scroll action we apply it without animation and transfer the difference in position to the panels.
// this is intentionally applied before updating the visible range below, to avoid animating new items (sourced from pool) from locations off-screen, as it looks bad.
if (pendingScrollOperation != PendingScrollOperation.None)