Continue confirming when rehovering if mouse is still down

This commit is contained in:
Joseph Madamba 2023-02-10 19:09:30 -08:00
parent d30d054b4c
commit 94d6ab1ec7

View File

@ -57,6 +57,7 @@ namespace osu.Game.Overlays.Dialog
private Sample confirmSample; private Sample confirmSample;
private double lastTickPlaybackTime; private double lastTickPlaybackTime;
private AudioFilter lowPassFilter = null!; private AudioFilter lowPassFilter = null!;
private bool mouseDown;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
@ -83,6 +84,7 @@ namespace osu.Game.Overlays.Dialog
protected override bool OnMouseDown(MouseDownEvent e) protected override bool OnMouseDown(MouseDownEvent e)
{ {
BeginConfirm(); BeginConfirm();
mouseDown = true;
return true; return true;
} }
@ -92,14 +94,23 @@ namespace osu.Game.Overlays.Dialog
{ {
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
AbortConfirm(); AbortConfirm();
mouseDown = false;
} }
} }
protected override bool OnHover(HoverEvent e)
{
if (mouseDown)
BeginConfirm();
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
base.OnHoverLost(e); base.OnHoverLost(e);
if (!e.HasAnyButtonPressed) return; if (!mouseDown) return;
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
AbortConfirm(); AbortConfirm();