Browse Source

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).

omar 7 years ago
parent
commit
5ed45d0aec
1 changed files with 2 additions and 11 deletions
  1. 2 11
      imgui.cpp

+ 2 - 11
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);