mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-14 16:59:54 +02:00
Tables: fixed GetContentRegionAvail().y report not taking account of lower cell padding or of using ImGuiTableFlags_NoHostExtendY. (#6619)
Made GetContentRegionMax() fully defer to WorkRect when inside a table container.
This commit is contained in:
@ -1126,6 +1126,14 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
||||
table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f);
|
||||
table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f);
|
||||
|
||||
// Setup window's WorkRect.Max.y for GetContentRegionAvail(). Other values will be updated in each TableBeginCell() call.
|
||||
float window_content_max_y;
|
||||
if (table->Flags & ImGuiTableFlags_NoHostExtendY)
|
||||
window_content_max_y = table->OuterRect.Max.y;
|
||||
else
|
||||
window_content_max_y = ImMax(table->InnerWindow->ContentRegionRect.Max.y, (table->Flags & ImGuiTableFlags_ScrollY) ? 0.0f : table->OuterRect.Max.y);
|
||||
table->InnerWindow->WorkRect.Max.y = ImClamp(window_content_max_y - g.Style.CellPadding.y, table->InnerWindow->WorkRect.Min.y, table->InnerWindow->WorkRect.Max.y);
|
||||
|
||||
// [Part 9] Allocate draw channels and setup background cliprect
|
||||
TableSetupDrawChannels(table);
|
||||
|
||||
@ -2011,6 +2019,7 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
|
||||
window->DC.CurrLineTextBaseOffset = table->RowTextBaseline;
|
||||
window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent;
|
||||
|
||||
// Note how WorkRect.Max.y is only set once during layout
|
||||
window->WorkRect.Min.y = window->DC.CursorPos.y;
|
||||
window->WorkRect.Min.x = column->WorkMinX;
|
||||
window->WorkRect.Max.x = column->WorkMaxX;
|
||||
@ -3974,6 +3983,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiOldColumnFl
|
||||
window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
|
||||
window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
|
||||
window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
|
||||
window->WorkRect.Max.y = window->ContentRegionRect.Max.y;
|
||||
}
|
||||
|
||||
void ImGui::NextColumn()
|
||||
|
Reference in New Issue
Block a user