Tables: columns freeze doesn't enforce a particular order + rework changelog for clarity. (#9312)

This commit is contained in:
ocornut
2026-04-02 13:59:36 +02:00
parent 39d1be05e8
commit 02e9b8cacd
2 changed files with 6 additions and 19 deletions

View File

@@ -97,12 +97,12 @@ Other Changes:
- Context menu now presents columns in display order. (#9312)
- Fixed and clarified the behavior of using TableSetupScrollFreeze() with columns>1,
and where some of the columns within that range were Hidable.
- Before: TableSetupScrollFreeze(N, 0) made the first N _visible_ columns
part of the scroll freeze. So if you intentionally hide columns <N
the scroll freeze area would encompass the subsequent right columns.
- After: TableSetupScrollFreeze(N, 0) makes the first N _declared_ columns
part of the scroll freeze. So if you intentionally hide columns <N
the scroll freeze area will cover less columns.
- Before: TableSetupScrollFreeze(N, 0): include the N left-most visible columns as
part of the scroll freeze. So if you intentionally hide columns <N, the scroll
freeze area would start covering the subsequent/following columns (N+1) etc.
- After: TableSetupScrollFreeze(N, 0): include the N left-most columns (regardless of visibility),
as part of the scroll freeze. So if you intentionally hide columns <N, the scroll
freeze area will cover less columns.
- This is generally more sane and logical.
- Fixed dragging a header to reorder outside of visible bounds (due to horizontal scrolling)
from losing active id.

View File

@@ -1695,19 +1695,6 @@ void ImGui::TableSetupScrollFreeze(int columns, int rows)
table->FreezeRowsRequest = (table->Flags & ImGuiTableFlags_ScrollY) ? (ImGuiTableColumnIdx)rows : 0;
table->FreezeRowsCount = (table->InnerWindow->Scroll.y != 0.0f) ? table->FreezeRowsRequest : 0;
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
// Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.
// FIXME-TABLE: This work for preserving 2143 into 21|43. How about 4321 turning into 21|43? (preserve relative order in each section)
for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)
{
int order_n = table->DisplayOrderToIndex[column_n];
if (order_n != column_n && order_n >= table->FreezeColumnsRequest)
{
ImSwap(table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder, table->Columns[table->DisplayOrderToIndex[column_n]].DisplayOrder);
ImSwap(table->DisplayOrderToIndex[order_n], table->DisplayOrderToIndex[column_n]);
table->IsSettingsDirty = true;
}
}
}
//-----------------------------------------------------------------------------