mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 16:25:32 +08:00
Add initial pass of vertical transforms
This commit is contained in:
parent
15325f5f51
commit
8847cedf29
@ -566,12 +566,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
bool revalidateItems = !itemsCache.IsValid;
|
bool revalidateItems = !itemsCache.IsValid;
|
||||||
|
|
||||||
//todo: this should only refresh items, not everything here
|
|
||||||
if (revalidateItems)
|
if (revalidateItems)
|
||||||
updateItems();
|
updateYPositions();
|
||||||
|
|
||||||
// Remove all items that should no longer be on-screen
|
|
||||||
//scrollableContent.RemoveAll(p => p.Y < visibleUpperBound - p.DrawHeight || p.Y > visibleBottomBound || !p.IsPresent);
|
|
||||||
|
|
||||||
// Find index range of all items that should be on-screen
|
// Find index range of all items that should be on-screen
|
||||||
int firstIndex = yPositions.BinarySearch(visibleUpperBound);
|
int firstIndex = yPositions.BinarySearch(visibleUpperBound);
|
||||||
@ -586,6 +582,9 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
if (revalidateItems || firstIndex != displayedRange.first || lastIndex != displayedRange.last)
|
if (revalidateItems || firstIndex != displayedRange.first || lastIndex != displayedRange.last)
|
||||||
{
|
{
|
||||||
|
// Remove all items that should no longer be on-screen
|
||||||
|
scrollableContent.RemoveAll(p => p.Y + p.Item.TotalHeight < visibleUpperBound || p.Y > visibleBottomBound);
|
||||||
|
|
||||||
displayedRange = (firstIndex, lastIndex);
|
displayedRange = (firstIndex, lastIndex);
|
||||||
|
|
||||||
// Add those items within the previously found index range that should be displayed.
|
// Add those items within the previously found index range that should be displayed.
|
||||||
@ -598,11 +597,22 @@ namespace osu.Game.Screens.Select
|
|||||||
if (panel == null)
|
if (panel == null)
|
||||||
{
|
{
|
||||||
panel = setPool.Get(p => p.Item = item);
|
panel = setPool.Get(p => p.Item = item);
|
||||||
|
panel.Y = yPositions[i];
|
||||||
|
panel.Depth = i;
|
||||||
|
|
||||||
|
panel.ClearTransforms();
|
||||||
|
|
||||||
scrollableContent.Add(panel);
|
scrollableContent.Add(panel);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (panel.IsPresent)
|
||||||
|
panel.MoveToY(yPositions[i], 800, Easing.OutQuint);
|
||||||
|
else
|
||||||
|
panel.Y = yPositions[i];
|
||||||
|
|
||||||
panel.Y = yPositions[i];
|
scrollableContent.ChangeChildDepth(panel, i);
|
||||||
scrollableContent.ChangeChildDepth(panel, i);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,7 +692,7 @@ namespace osu.Game.Screens.Select
|
|||||||
/// Computes the target Y positions for every item in the carousel.
|
/// Computes the target Y positions for every item in the carousel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The Y position of the currently selected item.</returns>
|
/// <returns>The Y position of the currently selected item.</returns>
|
||||||
private void updateItems()
|
private void updateYPositions()
|
||||||
{
|
{
|
||||||
yPositions.Clear();
|
yPositions.Clear();
|
||||||
visibleItems.Clear();
|
visibleItems.Clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user