From 9e7712740b2d881c14bb8f0872e124d95436fe0a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 May 2024 23:32:24 +0800 Subject: [PATCH] Refactor for legibility --- .../Graphics/UserInterface/DrawableStatefulMenuItem.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs b/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs index 8ed52593a7..686c490930 100644 --- a/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs @@ -23,13 +23,11 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnMouseDown(MouseDownEvent e) { - if (!IsActionable) - return true; + // Right mouse button is a special case where we allow actioning without dismissing the menu. + // This is achieved by not calling `Clicked` (as done by the base implementation in OnClick). + if (IsActionable && e.Button == MouseButton.Right) + Item.Action.Value?.Invoke(); - if (e.Button != MouseButton.Right) - return true; - - Item.Action.Value?.Invoke(); return true; }