mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 21:09:01 +08: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:
parent
2bc5d17ac3
commit
db66e33e9e
@ -64,6 +64,10 @@ Other changes:
|
||||
- InputText: Fixed a case where deactivation frame would write to underlying
|
||||
buffer or call CallbackResize although unnecessary, in a frame where the
|
||||
return value was false.
|
||||
- Tables: fixed GetContentRegionAvail().y report not taking account of lower cell
|
||||
padding or of using ImGuiTableFlags_NoHostExtendY. Not taking it into account
|
||||
would make the idiom of creating vertically bottom-aligned content (e.g. a child
|
||||
window) inside a table make the parent window erroneously have a scrollbar. (#6619)
|
||||
- Tables: fixed calculation of multi-instance shared decoration/scrollbar width of
|
||||
scrolling tables, to avoid flickering width variation when resizing down a table
|
||||
hosting a child window. (#5920, #6619)
|
||||
|
@ -9774,9 +9774,7 @@ ImVec2 ImGui::GetContentRegionMax()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImVec2 mx = window->ContentRegionRect.Max;
|
||||
if (window->DC.CurrentColumns || g.CurrentTable)
|
||||
mx.x = window->WorkRect.Max.x;
|
||||
ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max;
|
||||
return mx - window->Pos;
|
||||
}
|
||||
|
||||
@ -9785,9 +9783,7 @@ ImVec2 ImGui::GetContentRegionMaxAbs()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImVec2 mx = window->ContentRegionRect.Max;
|
||||
if (window->DC.CurrentColumns || g.CurrentTable)
|
||||
mx.x = window->WorkRect.Max.x;
|
||||
ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max;
|
||||
return mx;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user