1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-25 18:57:18 +08:00

Fix expanded state not updating on drag end

This commit is contained in:
Dean Herbert 2025-02-14 15:15:05 +09:00
parent 3f3cb3df2a
commit 9456e376f3
No known key found for this signature in database

View File

@ -57,6 +57,8 @@ namespace osu.Game.Overlays
private InputManager inputManager = null!;
private Drawable? draggedChild;
/// <summary>
/// Create a new instance.
/// </summary>
@ -161,6 +163,13 @@ namespace osu.Game.Overlays
headerText.FadeTo(headerText.DrawWidth < DrawWidth ? 1 : 0, 150, Easing.OutQuint);
headerTextVisibilityCache.Validate();
}
// Dragged child finished its drag operation.
if (draggedChild != null && inputManager.DraggedDrawable != draggedChild)
{
draggedChild = null;
updateExpandedState(true);
}
}
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
@ -173,13 +182,17 @@ namespace osu.Game.Overlays
private void updateExpandedState(bool animate)
{
// before we collapse down, let's double check the user is not dragging a UI control contained within us.
if (inputManager.DraggedDrawable.IsRootedAt(this))
{
draggedChild = inputManager.DraggedDrawable;
}
// clearing transforms is necessary to avoid a previous height transform
// potentially continuing to get processed while content has changed to autosize.
content.ClearTransforms();
bool sliderDraggedInHimself = inputManager.DraggedDrawable.IsRootedAt(this);
if (Expanded.Value || IsHovered || sliderDraggedInHimself)
if (Expanded.Value || IsHovered || draggedChild != null)
{
content.AutoSizeAxes = Axes.Y;
content.AutoSizeDuration = animate ? transition_duration : 0;