From 65e9419433b8aa9f8bfe0a0667d66b552049bddc Mon Sep 17 00:00:00 2001 From: Hannele Ruiz Date: Sat, 14 Nov 2020 02:14:31 -0300 Subject: [PATCH] Added option to close the menu when clicking outside of the items --- LemonUI/Menus/NativeMenu.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/LemonUI/Menus/NativeMenu.cs b/LemonUI/Menus/NativeMenu.cs index 23fa21d7..4a93d768 100644 --- a/LemonUI/Menus/NativeMenu.cs +++ b/LemonUI/Menus/NativeMenu.cs @@ -537,6 +537,10 @@ public string Subtitle /// public bool UseMouse { get; set; } = true; /// + /// If the menu should be closed when the user clicks out of bounds (aka anywhere else other than the items). + /// + public bool CloseOnInvalidClick { get; set; } = true; + /// /// If the camera should be rotated when the cursor is on the left and right corners of the screen. /// public bool RotateCamera { get; set; } = false; @@ -1009,8 +1013,11 @@ private void ProcessControls() } // If we got here, the user clicked outside of the selected item area - // So close the menu (same behavior of the interaction menu) - Close(); + // So close the menu if required (same behavior of the interaction menu) + if (CloseOnInvalidClick) + { + Close(); + } return; } }