From fae362fd0bec74f147e03d60788dc3a64a105873 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 30 Oct 2020 19:38:59 +0100 Subject: [PATCH] Tables: fixed auto-fitting columns not marking settings as dirty + fixed CellBg fill not narrow clipping on ScrollX + freeze. --- imgui_tables.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 4b39eab2..68333fb9 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -496,6 +496,9 @@ void ImGui::TableBeginUpdateColumns(ImGuiTable* table) // the column fitting to wait until the first visible frame of the child container (may or not be a good thing). if (want_column_auto_fit && table->OuterWindow != table->InnerWindow) table->InnerWindow->SkipItems = false; + + if (want_column_auto_fit) + table->IsSettingsDirty = true; } // Adjust flags: default width mode + stretch columns are not allowed when auto extending @@ -1752,6 +1755,8 @@ void ImGui::TableEndRow(ImGuiTable* table) { ImRect cell_bg_rect = TableGetCellBgRect(table, cell_data->Column); cell_bg_rect.ClipWith(table->BackgroundClipRect); + cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, table->Columns[cell_data->Column].ClipRect.Min.x); + cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, table->Columns[cell_data->Column].ClipRect.Max.x); window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor); } }