From 54fb051e52bbff345340972520a2efd5693f066b Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 28 Feb 2022 16:12:43 +0100 Subject: [PATCH] ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. --- docs/CHANGELOG.txt | 1 + imgui_widgets.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 21e783b42..53ec76892 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -56,6 +56,7 @@ Other Changes: - IsItemHovered(): added ImGuiHoveredFlags_NoNavOverride to disable the behavior where the return value is overriden by focus when gamepad/keyboard navigation is active. - Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate. +- ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. - Stack Tool: Added option to copy item path to clipboard. (#4631) - Misc: Fixed IsAnyItemHovered() returning false when using navigation. - Misc: Added constexpr to ImVec2/ImVec4 inline constructors. (#4995) [@Myriachan] diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 21415a742..64e7aa9cd 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4997,8 +4997,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel)) { - 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); + SameLine(0.0f, style.ItemInnerSpacing.x); TextEx(label, label_display_end); }