From 5ed45d0aec76ffae27e8089024c8b4531c7214e0 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 4 Mar 2018 17:55:59 +0100 Subject: [PATCH] Columns: Fixed destructive small resize. (#1656). The OffsetNorm clamp introduced by #913 was ok as it didn't write back into the storage, which #1499 started doing making it destructive. Right now I don't think the clamp is needed at all. It had uses (eg: hide the issue fixed by bf7481eba01252f3e53590c7c592b86b318bcd52). --- imgui.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index d999133641ee..bfbac41f720a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12537,19 +12537,10 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag } } - for (int n = 0; n < columns_count + 1; n++) + for (int n = 0; n < columns_count; n++) { - // Clamp position - ImGuiColumnData* column = &columns->Columns[n]; - float t = column->OffsetNorm; - if (!(columns->Flags & ImGuiColumnsFlags_NoForceWithinWindow)) - t = ImMin(t, PixelsToOffsetNorm(columns, (columns->MaxX - columns->MinX) - g.Style.ColumnsMinSpacing * (columns->Count - n))); - column->OffsetNorm = t; - - if (n == columns_count) - continue; - // Compute clipping rectangle + ImGuiColumnData* column = &columns->Columns[n]; float clip_x1 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(n) - 1.0f); float clip_x2 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(n + 1) - 1.0f); column->ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX);