mirror of
https://github.com/osukey/osukey.git
synced 2025-05-23 06:27:24 +09:00
make PlayerSettingsGroup
expand on hover
This commit is contained in:
parent
0b5c89d01f
commit
c3c1d77e8e
@ -16,7 +16,6 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
private const int fade_duration = 200;
|
private const int fade_duration = 200;
|
||||||
|
|
||||||
|
|
||||||
public bool ReplayLoaded;
|
public bool ReplayLoaded;
|
||||||
|
|
||||||
public readonly PlaybackSettings PlaybackSettings;
|
public readonly PlaybackSettings PlaybackSettings;
|
||||||
@ -42,13 +41,12 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
//CollectionSettings = new CollectionSettings(),
|
//CollectionSettings = new CollectionSettings(),
|
||||||
//DiscussionSettings = new DiscussionSettings(),
|
//DiscussionSettings = new DiscussionSettings(),
|
||||||
PlaybackSettings = new PlaybackSettings(),
|
PlaybackSettings = new PlaybackSettings { Expanded = { Value = false } },
|
||||||
VisualSettings = new VisualSettings()
|
VisualSettings = new VisualSettings { Expanded = { Value = false } }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.PlayerSettings
|
namespace osu.Game.Screens.Play.PlayerSettings
|
||||||
@ -15,12 +16,35 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScheduledDelegate hoverExpandEvent;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
|
updateHoverExpansion();
|
||||||
base.OnHover(e);
|
base.OnHover(e);
|
||||||
|
|
||||||
// Importantly, return true to correctly take focus away from PlayerLoader.
|
// Importantly, return true to correctly take focus away from PlayerLoader.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
if (hoverExpandEvent == null) return;
|
||||||
|
|
||||||
|
hoverExpandEvent?.Cancel();
|
||||||
|
hoverExpandEvent = null;
|
||||||
|
|
||||||
|
Expanded.Value = false;
|
||||||
|
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateHoverExpansion()
|
||||||
|
{
|
||||||
|
hoverExpandEvent?.Cancel();
|
||||||
|
|
||||||
|
if (IsHovered && !Expanded.Value)
|
||||||
|
hoverExpandEvent = Scheduler.AddDelayed(() => Expanded.Value = true, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user