1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:07:52 +08:00

Move hover logic to SettingsToolboxGroup to avoid expanded state clash

This commit is contained in:
Dean Herbert 2023-01-17 14:43:22 +09:00
parent 6a0bf89401
commit a02556d2fa
2 changed files with 3 additions and 19 deletions

View File

@ -135,12 +135,14 @@ namespace osu.Game.Overlays
protected override bool OnHover(HoverEvent e)
{
updateFadeState();
updateExpandedState(true);
return false;
}
protected override void OnHoverLost(HoverLostEvent e)
{
updateFadeState();
updateExpandedState(true);
base.OnHoverLost(e);
}
@ -168,7 +170,7 @@ namespace osu.Game.Overlays
// potentially continuing to get processed while content has changed to autosize.
content.ClearTransforms();
if (Expanded.Value)
if (Expanded.Value || IsHovered)
{
content.AutoSizeAxes = Axes.Y;
content.AutoSizeDuration = animate ? transition_duration : 0;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Input.Events;
using osu.Game.Overlays;
@ -15,28 +13,12 @@ namespace osu.Game.Screens.Play.PlayerSettings
{
}
private bool expandedByDefault = true;
protected override bool OnHover(HoverEvent e)
{
if (IsHovered && !Expanded.Value)
{
Expanded.Value = true;
expandedByDefault = false;
}
base.OnHover(e);
// Importantly, return true to correctly take focus away from PlayerLoader.
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
if (!expandedByDefault)
Expanded.Value = false;
base.OnHoverLost(e);
}
}
}