Procházet zdrojové kódy

ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label.

ocornut před 3 roky
rodič
revize
54fb051e52
2 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 1 0
      docs/CHANGELOG.txt
  2. 1 2
      imgui_widgets.cpp

+ 1 - 0
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]

+ 1 - 2
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);
     }