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

This commit is contained in:
ocornut 2015-04-19 23:37:50 +01:00
parent 064b94721e
commit 37d8d78fc2

View File

@ -6980,6 +6980,7 @@ 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); 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); ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ItemSize(bb); ItemSize(bb);
if (size_arg.x == 0.0f)
bb.Max.x += style.AutoFitPadding.x; 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. // Selectables are meant to be tightly packed together. So for both rendering and collision we extend to compensate for spacing.