mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Tables: Fix ImGuiTableColumnFlags_WidthAlwaysAutoResize columns when clipped (which would be default behavior without _Resizable and when clipping/scrolling)
This commit is contained in:
parent
25b5cc2f95
commit
248960d64c
@ -646,11 +646,9 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
|
|
||||||
if (column->Flags & (ImGuiTableColumnFlags_WidthAlwaysAutoResize | ImGuiTableColumnFlags_WidthFixed))
|
if (column->Flags & (ImGuiTableColumnFlags_WidthAlwaysAutoResize | ImGuiTableColumnFlags_WidthFixed))
|
||||||
{
|
{
|
||||||
// Latch initial size for fixed columns
|
// Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!)
|
||||||
count_fixed += 1;
|
count_fixed += 1;
|
||||||
const bool auto_fit = (column->AutoFitQueue != 0x00) || (column->Flags & ImGuiTableColumnFlags_WidthAlwaysAutoResize);
|
if ((column->AutoFitQueue != 0x00) || ((column->Flags & ImGuiTableColumnFlags_WidthAlwaysAutoResize) && !column->IsClipped))
|
||||||
if (auto_fit)
|
|
||||||
{
|
|
||||||
column->WidthRequest = column_width_ideal;
|
column->WidthRequest = column_width_ideal;
|
||||||
|
|
||||||
// FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets
|
// FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets
|
||||||
@ -660,7 +658,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
// FIXME: Move this to ->WidthGiven to avoid temporary lossyless?
|
// FIXME: Move this to ->WidthGiven to avoid temporary lossyless?
|
||||||
if (column->AutoFitQueue > 0x01 && table->IsInitializing)
|
if (column->AutoFitQueue > 0x01 && table->IsInitializing)
|
||||||
column->WidthRequest = ImMax(column->WidthRequest, min_column_width * 4.0f);
|
column->WidthRequest = ImMax(column->WidthRequest, min_column_width * 4.0f);
|
||||||
}
|
|
||||||
sum_width_fixed_requests += column->WidthRequest;
|
sum_width_fixed_requests += column->WidthRequest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2159,7 +2157,7 @@ void ImGui::TableHeadersRow()
|
|||||||
// Emit a column header (text + optional sort order)
|
// Emit a column header (text + optional sort order)
|
||||||
// We cpu-clip text here so that all columns headers can be merged into a same draw call.
|
// We cpu-clip text here so that all columns headers can be merged into a same draw call.
|
||||||
// Note that because of how we cpu-clip and display sorting indicators, you _cannot_ use SameLine() after a TableHeader()
|
// Note that because of how we cpu-clip and display sorting indicators, you _cannot_ use SameLine() after a TableHeader()
|
||||||
// FIXME-TABLE: Should hold a selection state.
|
// FIXME-TABLE: Could hold a selection state.
|
||||||
// FIXME-TABLE: Style confusion between CellPadding.y and FramePadding.y
|
// FIXME-TABLE: Style confusion between CellPadding.y and FramePadding.y
|
||||||
void ImGui::TableHeader(const char* label)
|
void ImGui::TableHeader(const char* label)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user