From cf9f8ec196d02cb748f654a61236439097f1324a Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Mon, 6 Jan 2020 16:51:48 +0200 Subject: [PATCH] Fix text alignment of ColorEdit widgets with ImGuiColorEditFlags_NoInputs flag. Fixes #2955. --- imgui_widgets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index cc7c2edd412a..6104ba89c974 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4344,7 +4344,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel)) { - window->DC.CursorPos = ImVec2(pos.x + w_full + style.ItemInnerSpacing.x, pos.y + style.FramePadding.y); + const float text_offset_x = flags & ImGuiColorEditFlags_NoInputs ? w_button : w_full + style.ItemInnerSpacing.x; + window->DC.CursorPos = ImVec2(pos.x + text_offset_x, pos.y + style.FramePadding.y); TextEx(label, label_display_end); }