From d30d054b4c4ad7de66af26ff41985658854f6f15 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 9 Feb 2023 21:28:51 -0800 Subject: [PATCH] Add ability to abort dangerous dialog button on hover lost --- osu.Game/Graphics/Containers/HoldToConfirmContainer.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index cbe327bac7..0ac368dca7 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -102,7 +102,7 @@ namespace osu.Game.Graphics.Containers /// protected void AbortConfirm() { - if (!AllowMultipleFires && Fired) return; + if (!confirming || (!AllowMultipleFires && Fired)) return; confirming = false; Fired = false; diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 6b3716ac8d..dac589919f 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -95,6 +95,16 @@ namespace osu.Game.Overlays.Dialog } } + protected override void OnHoverLost(HoverLostEvent e) + { + base.OnHoverLost(e); + + if (!e.HasAnyButtonPressed) return; + + lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); + AbortConfirm(); + } + private void progressChanged(ValueChangedEvent progress) { if (progress.NewValue < progress.OldValue) return;