mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Move drawable carousel set movement logic into panels themselves
This commit is contained in:
@ -618,16 +618,6 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, if the filtered items have changed, animate drawables to their new locations.
|
|
||||||
// This is common if a selected/collapsed state has changed.
|
|
||||||
if (revalidateItems)
|
|
||||||
{
|
|
||||||
foreach (DrawableCarouselItem panel in ScrollableContent.Children)
|
|
||||||
{
|
|
||||||
panel.MoveToY(panel.Item.CarouselYPosition, 800, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update externally controlled state of currently visible items (e.g. x-offset and opacity).
|
// Update externally controlled state of currently visible items (e.g. x-offset and opacity).
|
||||||
// This is a per-frame update on all drawable panels.
|
// This is a per-frame update on all drawable panels.
|
||||||
foreach (DrawableCarouselItem item in Scroll.Children)
|
foreach (DrawableCarouselItem item in Scroll.Children)
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Collections;
|
using osu.Game.Collections;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -60,6 +61,25 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
viewDetails = beatmapOverlay.FetchAndShowBeatmapSet;
|
viewDetails = beatmapOverlay.FetchAndShowBeatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
// position updates should not occur if the item is filtered away.
|
||||||
|
// this avoids panels flying across the screen only to be eventually off-screen or faded out.
|
||||||
|
if (!Item.Visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float targetY = Item.CarouselYPosition;
|
||||||
|
|
||||||
|
if (Precision.AlmostEquals(targetY, Y))
|
||||||
|
Y = targetY;
|
||||||
|
else
|
||||||
|
// algorithm for this is taken from ScrollContainer.
|
||||||
|
// while it doesn't necessarily need to match 1:1, as we are emulating scroll in some cases this feels most correct.
|
||||||
|
Y = (float)Interpolation.Lerp(targetY, Y, Math.Exp(-0.01 * Time.Elapsed));
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateItem()
|
protected override void UpdateItem()
|
||||||
{
|
{
|
||||||
base.UpdateItem();
|
base.UpdateItem();
|
||||||
|
Reference in New Issue
Block a user