Skip to content

Commit

Permalink
Selectable() render into AutoFitPadding but do not extend it, fixing …
Browse files Browse the repository at this point in the history
…small visual gap

Followup 2e26196 /  #1
  • Loading branch information
ocornut committed Apr 3, 2015
1 parent f3967f1 commit aac9981
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6768,8 +6768,9 @@ bool ImGui::Selectable(const char* label, bool selected, const ImVec2& size_arg)

const float w = ImMax(label_size.x, window->Pos.x + ImGui::GetContentRegionMax().x - style.AutoFitPadding.x - window->DC.CursorPos.x);
const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : w, size_arg.y != 0.0f ? size_arg.y : label_size.y);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ItemSize(bb);
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;
Expand Down

0 comments on commit aac9981

Please # to comment.