From e0e7e123bf7d052b074d1cbfbda82e6678a5d3cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Brandst=C3=B6tter?= Date: Fri, 3 May 2024 16:57:31 +0200 Subject: [PATCH] Keep menus open when clicking a stateful item with CTRL held --- .../UserInterface/DrawableStatefulMenuItem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs b/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs index 5af275c9e7..d63aaf2053 100644 --- a/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs @@ -4,6 +4,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using osuTK; namespace osu.Game.Graphics.UserInterface @@ -19,6 +20,17 @@ namespace osu.Game.Graphics.UserInterface protected override TextContainer CreateTextContainer() => new ToggleTextContainer(Item); + private InputManager inputManager = null!; + + public override bool CloseMenuOnClick => !inputManager.CurrentState.Keyboard.ControlPressed; + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + } + private partial class ToggleTextContainer : TextContainer { private readonly StatefulMenuItem menuItem;