From b177f2432dd9ab90f765adf39a6376e4ddea7bb9 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 22 Oct 2017 10:36:22 +0200 Subject: [PATCH] MenuItem(): Tweak to not draw over all horizontal space when in horizontal layout mode. (#1387) --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 15a4e5cd..c3e97846 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9083,7 +9083,8 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo float w = window->MenuColumns.DeclColumns(label_size.x, shortcut_size.x, (float)(int)(g.FontSize * 1.20f)); // Feedback for next frame float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w); - bool pressed = Selectable(label, false, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DrawFillAvailWidth | (enabled ? 0 : ImGuiSelectableFlags_Disabled), ImVec2(w, 0.0f)); + ImGuiSelectableFlags flags = ImGuiSelectableFlags_MenuItem | (enabled ? 0 : ImGuiSelectableFlags_Disabled) | (window->DC.LayoutType == ImGuiLayoutType_Vertical ? ImGuiSelectableFlags_DrawFillAvailWidth : 0); + bool pressed = Selectable(label, false, flags, ImVec2(w, 0.0f)); if (shortcut_size.x > 0.0f) { PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);