From 98540370a0fec1c0b27b9daae21c73abb504fdd0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 25 May 2015 23:15:00 +0100 Subject: [PATCH] WIP Menus: Layout in menu-bar tweaks to lay better when mixed widgets (#126) --- imgui.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 6cfc0ccd..1c203dca 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7580,11 +7580,13 @@ bool ImGui::BeginMenu(const char* label) if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) { popup_pos = ImVec2(pos.x - window->WindowPadding().x, pos.y - style.FramePadding.y + window->MenuBarHeight()); + window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f); float w = label_size.x; pressed = SelectableEx(label, opened, ImVec2(w, 0.0f), ImVec2(w, 0.0f), true, true, false); - ImGui::SameLine(); ImGui::PopStyleVar(); + ImGui::SameLine(); + window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); } else {