mirror of
https://github.com/Drezil/imgui.git
synced 2025-03-31 08:22:44 +00:00
Internals: Popups: EndMenu() calls ClosePopupToLevel(g.CurrentPopupStack.Size) which is more correct.
This commit is contained in:
parent
f1c7596409
commit
f6f5c51106
@ -5687,14 +5687,14 @@ 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.
|
// Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu).
|
||||||
// A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
|
// A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
|
||||||
// However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
// However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
||||||
{
|
{
|
||||||
ClosePopupToLevel(g.OpenPopupStack.Size - 1);
|
ClosePopupToLevel(g.CurrentPopupStack.Size);
|
||||||
NavMoveRequestCancel();
|
NavMoveRequestCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user