mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Make mod effect preview uncollapse on hover
This commit is contained in:
parent
d51396fdaf
commit
eebacfb982
@ -20,6 +20,7 @@ using osu.Game.Rulesets.Mods;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using System.Threading;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Mods
|
||||
const float shear = ShearedOverlayContainer.SHEAR;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
InternalChild = content = new InputBlockingContainer
|
||||
InternalChild = content = new Container
|
||||
{
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
@ -172,10 +173,26 @@ namespace osu.Game.Overlays.Mods
|
||||
updateValues();
|
||||
}, true);
|
||||
|
||||
Collapsed.BindValueChanged(collapsed => outerContent.FadeTo(collapsed.NewValue ? 0 : 1, transition_duration, Easing.OutQuint), true);
|
||||
Collapsed.BindValueChanged(_ => updateCollapsedState(), true);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
updateCollapsedState();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
updateCollapsedState();
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||
|
||||
protected override bool OnClick(ClickEvent e) => true;
|
||||
|
||||
private void updateValues() => Scheduler.AddOnce(() =>
|
||||
{
|
||||
if (BeatmapInfo.Value == null)
|
||||
@ -207,6 +224,11 @@ namespace osu.Game.Overlays.Mods
|
||||
overallDifficultyDisplay.Current.Value = adjustedDifficulty.OverallDifficulty;
|
||||
});
|
||||
|
||||
private void updateCollapsedState()
|
||||
{
|
||||
outerContent.FadeTo(Collapsed.Value && !IsHovered ? 0 : 1, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private partial class BPMDisplay : RollingCounter<double>
|
||||
{
|
||||
protected override double RollingDuration => 500;
|
||||
|
@ -924,6 +924,9 @@ namespace osu.Game.Overlays.Mods
|
||||
OnClicked?.Invoke();
|
||||
return true;
|
||||
|
||||
case HoverEvent:
|
||||
return false;
|
||||
|
||||
case MouseEvent:
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user