From 34728394ec9b5b38f08fef9157da4787c23e74f0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 26 Dec 2014 12:38:13 +0000 Subject: [PATCH] Fixed clipped ImGui::Combo not registering its size properly (was flickering when scrolling with combo on the edge of clipping region) --- imgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 35592acf..16951ecf 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4935,17 +4935,17 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi const ImGuiID id = window->GetID(label); const ImVec2 text_size = CalcTextSize(label); - const float arrow_size = (window->FontSize() + style.FramePadding.x * 2.0f); const ImGuiAabb frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(window->DC.ItemWidth.back(), text_size.y) + style.FramePadding*2.0f); - const ImGuiAabb bb(frame_bb.Min, frame_bb.Max + ImVec2(style.ItemInnerSpacing.x + text_size.x,0)); + ItemSize(frame_bb); if (ClipAdvance(frame_bb)) return false; + const ImGuiAabb bb(frame_bb.Min, frame_bb.Max + ImVec2(style.ItemInnerSpacing.x + text_size.x,0)); + const float arrow_size = (window->FontSize() + style.FramePadding.x * 2.0f); const bool hovered = (g.HoveredWindow == window) && (g.HoveredId == 0) && IsMouseHoveringBox(bb); bool value_changed = false; - ItemSize(frame_bb); RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg)); RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, window->Color(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button)); RenderCollapseTriangle(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y) + style.FramePadding, true);