Tables: Amend support for cross-cell SameLine() for first column. Amend 9a93fb5 + 8f5ce73.

This commit is contained in:
ocornut 2023-09-04 12:10:31 +02:00
parent 9a93fb5716
commit bdc4dfebf5

View File

@ -1750,7 +1750,6 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)
// We honor min_row_height requested by user, but cannot guarantee per-row maximum height,
// because that would essentially require a unique clipping rectangle per-cell.
table->CellPaddingY = g.Style.CellPadding.y;
table->RowPosY2 += table->CellPaddingY * 2.0f;
table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height);
@ -1761,6 +1760,7 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)
// [Internal] Called by TableNextRow()
void ImGui::TableBeginRow(ImGuiTable* table)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = table->InnerWindow;
IM_ASSERT(!table->IsInsideRow);
@ -1779,7 +1779,10 @@ void ImGui::TableBeginRow(ImGuiTable* table)
table->RowPosY1 = table->RowPosY2 = next_y1;
table->RowTextBaseline = 0.0f;
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
table->CellPaddingY = g.Style.CellPadding.y;
window->DC.PrevLineTextBaseOffset = 0.0f;
window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + table->CellPaddingY); // This allows users to call SameLine() to share LineSize between columns.
window->DC.PrevLineSize = window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); // This allows users to call SameLine() to share LineSize between columns, and to call it from first column too.
window->DC.IsSameLine = window->DC.IsSetPos = false;
window->DC.CursorMaxPos.y = next_y1;