瀏覽代碼

Selectable() render into AutoFitPadding only when full-fitting (fix aac99819d67079c4aa5b5ba64c6f946df704e8e7)

ocornut 10 年之前
父節點
當前提交
37d8d78fc2
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      imgui.cpp

+ 2 - 1
imgui.cpp

@@ -6980,7 +6980,8 @@ bool ImGui::Selectable(const char* label, bool selected, const ImVec2& size_arg)
     const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : w, size_arg.y != 0.0f ? size_arg.y : label_size.y);
     ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
     ItemSize(bb);
-    bb.Max.x += style.AutoFitPadding.x;
+    if (size_arg.x == 0.0f)
+        bb.Max.x += style.AutoFitPadding.x;
 
     // Selectables are meant to be tightly packed together. So for both rendering and collision we extend to compensate for spacing.
     ImRect bb_with_spacing = bb;