ソースを参照

ListBox: Fixed text-baseline offset when using SameLine()+Text() after a labeled ListBox().

Visible in demo->basic->listbox
ocornut 1 年間 前
コミット
9a2b598ec1
3 ファイル変更4 行追加0 行削除
  1. 1 0
      docs/CHANGELOG.txt
  2. 2 0
      imgui_demo.cpp
  3. 1 0
      imgui_widgets.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -73,6 +73,7 @@ Other changes:
   it would generally manifest when fast moving the mouse bottom to top in a sub-menu.
   (#7325, #7287, #7063)
 - ProgressBar: Fixed passing fraction==NaN from leading to a crash. (#7451)
+- ListBox: Fixed text-baseline offset when using SameLine()+Text() after a labeled ListBox().
 - Style: Added ImGuiStyleVar_TabBorderSize, ImGuiStyleVar_TableAngledHeadersAngle for
   consistency. (#7411) [@cfillion]
 - DrawList: Added AddConcavePolyFilled(), PathFillConcave() concave filling. (#760) [@thedmd]

+ 2 - 0
imgui_demo.cpp

@@ -1289,6 +1289,7 @@ static void ShowDemoWindowWidgets()
             }
             ImGui::EndListBox();
         }
+        ImGui::SameLine(); HelpMarker("Here we are sharing selection state between both boxes.");
 
         // Custom size: use all width, 5 items tall
         ImGui::Text("Full-width:");
@@ -1823,6 +1824,7 @@ static void ShowDemoWindowWidgets()
         static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
         ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
         ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));
+        //ImGui::SameLine(); HelpMarker("Consider using ImPlot instead!");
 
         // Fill an array of contiguous float values to plot
         // Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float

+ 1 - 0
imgui_widgets.cpp

@@ -6930,6 +6930,7 @@ bool ImGui::BeginListBox(const char* label, const ImVec2& size_arg)
         ImVec2 label_pos = ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y);
         RenderText(label_pos, label);
         window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, label_pos + label_size);
+        AlignTextToFramePadding();
     }
 
     BeginChild(id, frame_bb.GetSize(), ImGuiChildFlags_FrameStyle);