@ -10842,7 +10842,7 @@ void ImGui::EndMenuBar()
return ;
return ;
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
// When a move request within one of our child menu failed, capture the request to navigate among our siblings.
// Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings.
if ( g . NavMoveRequest & & g . NavMoveResultId = = 0 & & ( g . NavMoveDir = = ImGuiDir_Left | | g . NavMoveDir = = ImGuiDir_Right ) & & ( g . NavWindow - > Flags & ImGuiWindowFlags_ChildMenu ) )
if ( g . NavMoveRequest & & g . NavMoveResultId = = 0 & & ( g . NavMoveDir = = ImGuiDir_Left | | g . NavMoveDir = = ImGuiDir_Right ) & & ( g . NavWindow - > Flags & ImGuiWindowFlags_ChildMenu ) )
{
{
ImGuiWindow * nav_earliest_child = g . NavWindow ;
ImGuiWindow * nav_earliest_child = g . NavWindow ;
@ -10926,7 +10926,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
g . NavWindow = backed_nav_window ;
g . NavWindow = backed_nav_window ;
bool want_open = false , want_close = false ;
bool want_open = false , want_close = false ;
if ( window - > DC . LayoutType != ImGuiLayoutType_Horizont al) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))
if ( window - > DC . LayoutType == ImGuiLayoutType_Vertic al) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))
{
{
// Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.
// Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.
bool moving_within_opened_triangle = false ;
bool moving_within_opened_triangle = false ;
@ -10960,11 +10960,6 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
want_open = true ;
want_open = true ;
g . NavMoveRequest = false ;
g . NavMoveRequest = false ;
}
}
if ( g . NavWindow & & g . NavWindow - > ParentWindow = = window & & g . NavMoveRequest & & g . NavMoveDir = = ImGuiDir_Left & & IsPopupOpen ( id ) ) // Nav-Left to close
{
want_close = true ;
g . NavMoveRequest = false ;
}
}
}
else
else
{
{
@ -11013,6 +11008,15 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
void ImGui : : EndMenu ( )
void ImGui : : EndMenu ( )
{
{
// Nav: When a left move request within our child menu failed, close the menu
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
if ( g . NavWindow & & g . NavWindow - > ParentWindow = = window & & g . NavMoveRequest & & g . NavMoveResultId = = 0 & & g . NavMoveDir = = ImGuiDir_Left & & window - > DC . LayoutType = = ImGuiLayoutType_Vertical )
{
ClosePopupToLevel ( g . OpenPopupStack . Size - 1 ) ;
g . NavMoveRequest = false ;
}
EndPopup ( ) ;
EndPopup ( ) ;
}
}