mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 16:42:57 +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;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
const float shear = ShearedOverlayContainer.SHEAR;
|
const float shear = ShearedOverlayContainer.SHEAR;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
InternalChild = content = new InputBlockingContainer
|
InternalChild = content = new Container
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
@ -172,10 +173,26 @@ namespace osu.Game.Overlays.Mods
|
|||||||
updateValues();
|
updateValues();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
Collapsed.BindValueChanged(collapsed => outerContent.FadeTo(collapsed.NewValue ? 0 : 1, transition_duration, Easing.OutQuint), true);
|
Collapsed.BindValueChanged(_ => updateCollapsedState(), true);
|
||||||
FinishTransforms(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(() =>
|
private void updateValues() => Scheduler.AddOnce(() =>
|
||||||
{
|
{
|
||||||
if (BeatmapInfo.Value == null)
|
if (BeatmapInfo.Value == null)
|
||||||
@ -207,6 +224,11 @@ namespace osu.Game.Overlays.Mods
|
|||||||
overallDifficultyDisplay.Current.Value = adjustedDifficulty.OverallDifficulty;
|
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>
|
private partial class BPMDisplay : RollingCounter<double>
|
||||||
{
|
{
|
||||||
protected override double RollingDuration => 500;
|
protected override double RollingDuration => 500;
|
||||||
|
@ -924,6 +924,9 @@ namespace osu.Game.Overlays.Mods
|
|||||||
OnClicked?.Invoke();
|
OnClicked?.Invoke();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case HoverEvent:
|
||||||
|
return false;
|
||||||
|
|
||||||
case MouseEvent:
|
case MouseEvent:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user