Tables: fixed auto-fitting columns not marking settings as dirty + fixed CellBg fill not narrow clipping on ScrollX + freeze.

This commit is contained in:
ocornut 2020-10-30 19:38:59 +01:00
parent 9918b2f147
commit fae362fd0b

View File

@ -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). // 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) if (want_column_auto_fit && table->OuterWindow != table->InnerWindow)
table->InnerWindow->SkipItems = false; 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 // 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); ImRect cell_bg_rect = TableGetCellBgRect(table, cell_data->Column);
cell_bg_rect.ClipWith(table->BackgroundClipRect); 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); window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
} }
} }