mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-30 18:34:34 +01:00
Tables: more moving of code in EndTable(), should have no side-effect.
This commit is contained in:
parent
626e3e2b3b
commit
3e712631da
@ -1178,16 +1178,14 @@ void ImGui::EndTable()
|
|||||||
inner_window->DC.PrevLineSize = table->HostBackupPrevLineSize;
|
inner_window->DC.PrevLineSize = table->HostBackupPrevLineSize;
|
||||||
inner_window->DC.CurrLineSize = table->HostBackupCurrLineSize;
|
inner_window->DC.CurrLineSize = table->HostBackupCurrLineSize;
|
||||||
inner_window->DC.CursorMaxPos = table->HostBackupCursorMaxPos;
|
inner_window->DC.CursorMaxPos = table->HostBackupCursorMaxPos;
|
||||||
|
const float inner_content_max_y = table->RowPosY2;
|
||||||
|
IM_ASSERT(table->RowPosY2 == inner_window->DC.CursorPos.y);
|
||||||
if (inner_window != outer_window)
|
if (inner_window != outer_window)
|
||||||
{
|
inner_window->DC.CursorMaxPos.y = inner_content_max_y;
|
||||||
inner_window->DC.CursorMaxPos.y = table->RowPosY2;
|
|
||||||
}
|
|
||||||
else if (!(flags & ImGuiTableFlags_NoHostExtendY))
|
else if (!(flags & ImGuiTableFlags_NoHostExtendY))
|
||||||
{
|
table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_content_max_y); // Patch OuterRect/InnerRect height
|
||||||
table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_window->DC.CursorPos.y); // Patch OuterRect/InnerRect height
|
table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y);
|
||||||
outer_window->DC.CursorMaxPos.y = table->RowPosY2;
|
table->LastOuterHeight = table->OuterRect.GetHeight();
|
||||||
}
|
|
||||||
|
|
||||||
// Setup inner scrolling range
|
// Setup inner scrolling range
|
||||||
// FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
|
// FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
|
||||||
@ -1203,9 +1201,7 @@ void ImGui::EndTable()
|
|||||||
table->InnerWindow->DC.CursorMaxPos.x = max_pos_x;
|
table->InnerWindow->DC.CursorMaxPos.x = max_pos_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y);
|
// Pop clipping rect
|
||||||
table->LastOuterHeight = table->OuterRect.GetHeight();
|
|
||||||
|
|
||||||
if (!(flags & ImGuiTableFlags_NoClip))
|
if (!(flags & ImGuiTableFlags_NoClip))
|
||||||
inner_window->DrawList->PopClipRect();
|
inner_window->DrawList->PopClipRect();
|
||||||
inner_window->ClipRect = inner_window->DrawList->_ClipRectStack.back();
|
inner_window->ClipRect = inner_window->DrawList->_ClipRectStack.back();
|
||||||
@ -1302,6 +1298,10 @@ void ImGui::EndTable()
|
|||||||
else
|
else
|
||||||
outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, table->WorkRect.Min.x + outer_width); // For auto-fit
|
outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, table->WorkRect.Min.x + outer_width); // For auto-fit
|
||||||
|
|
||||||
|
// Override declared contents height
|
||||||
|
if (inner_window == outer_window && !(flags & ImGuiTableFlags_NoHostExtendY))
|
||||||
|
outer_window->DC.CursorMaxPos.y = ImMax(outer_window->DC.CursorMaxPos.y, inner_content_max_y);
|
||||||
|
|
||||||
// Save settings
|
// Save settings
|
||||||
if (table->IsSettingsDirty)
|
if (table->IsSettingsDirty)
|
||||||
TableSaveSettings(table);
|
TableSaveSettings(table);
|
||||||
|
Loading…
Reference in New Issue
Block a user