1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Allow ExpandingContainer to not auto expand on hover

This commit is contained in:
Dean Herbert 2023-12-27 02:33:02 +09:00
parent c55458e49c
commit 58476d5429
No known key found for this signature in database

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -26,6 +24,8 @@ namespace osu.Game.Graphics.Containers
/// </summary> /// </summary>
protected virtual double HoverExpansionDelay => 0; protected virtual double HoverExpansionDelay => 0;
protected virtual bool ExpandOnHover => true;
protected override Container<Drawable> Content => FillFlow; protected override Container<Drawable> Content => FillFlow;
protected FillFlowContainer FillFlow { get; } protected FillFlowContainer FillFlow { get; }
@ -53,7 +53,7 @@ namespace osu.Game.Graphics.Containers
}; };
} }
private ScheduledDelegate hoverExpandEvent; private ScheduledDelegate? hoverExpandEvent;
protected override void LoadComplete() protected override void LoadComplete()
{ {
@ -93,6 +93,9 @@ namespace osu.Game.Graphics.Containers
private void updateHoverExpansion() private void updateHoverExpansion()
{ {
if (!ExpandOnHover)
return;
hoverExpandEvent?.Cancel(); hoverExpandEvent?.Cancel();
if (IsHovered && !Expanded.Value) if (IsHovered && !Expanded.Value)