From aac99819d67079c4aa5b5ba64c6f946df704e8e7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 3 Apr 2015 14:40:15 +0100 Subject: [PATCH] Selectable() render into AutoFitPadding but do not extend it, fixing small visual gap Followup 2e26196aba66dc0fa304043764aa6f6499beee0f / #1 --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index ceace398..3a8dbfca 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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;