Skip to content

Commit

Permalink
Added option to close the menu when clicking outside of the items
Browse files Browse the repository at this point in the history
  • Loading branch information
justalemon committed Nov 14, 2020
1 parent cdb8328 commit 65e9419
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions LemonUI/Menus/NativeMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ public string Subtitle
/// </summary>
public bool UseMouse { get; set; } = true;
/// <summary>
/// If the menu should be closed when the user clicks out of bounds (aka anywhere else other than the items).
/// </summary>
public bool CloseOnInvalidClick { get; set; } = true;
/// <summary>
/// If the camera should be rotated when the cursor is on the left and right corners of the screen.
/// </summary>
public bool RotateCamera { get; set; } = false;
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 65e9419

Please sign in to comment.