Tables: storing LastFrozenHeight for frozen requests that don't have actual freezing due to zero scrolling. (#7821, #5143)
Amend 0b4a1a40 (ignore whitespace to view this patch easily)
This commit is contained in:
parent
c7b9256097
commit
249d5caedb
@ -1996,34 +1996,37 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||||||
// We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark end of row and
|
// We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark end of row and
|
||||||
// get the new cursor position.
|
// get the new cursor position.
|
||||||
if (unfreeze_rows_request)
|
if (unfreeze_rows_request)
|
||||||
|
{
|
||||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||||
table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main;
|
table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
if (unfreeze_rows_actual)
|
|
||||||
{
|
|
||||||
IM_ASSERT(table->IsUnfrozenRows == false);
|
|
||||||
const float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
|
const float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
|
||||||
table->IsUnfrozenRows = true;
|
|
||||||
table_instance->LastFrozenHeight = y0 - table->OuterRect.Min.y;
|
table_instance->LastFrozenHeight = y0 - table->OuterRect.Min.y;
|
||||||
|
|
||||||
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
|
if (unfreeze_rows_actual)
|
||||||
table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
|
|
||||||
table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
|
|
||||||
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
|
|
||||||
IM_ASSERT(table->Bg2ClipRectForDrawCmd.Min.y <= table->Bg2ClipRectForDrawCmd.Max.y);
|
|
||||||
|
|
||||||
float row_height = table->RowPosY2 - table->RowPosY1;
|
|
||||||
table->RowPosY2 = window->DC.CursorPos.y = table->WorkRect.Min.y + table->RowPosY2 - table->OuterRect.Min.y;
|
|
||||||
table->RowPosY1 = table->RowPosY2 - row_height;
|
|
||||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
|
||||||
{
|
{
|
||||||
ImGuiTableColumn* column = &table->Columns[column_n];
|
IM_ASSERT(table->IsUnfrozenRows == false);
|
||||||
column->DrawChannelCurrent = column->DrawChannelUnfrozen;
|
table->IsUnfrozenRows = true;
|
||||||
column->ClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y
|
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
|
||||||
SetWindowClipRectBeforeSetChannel(window, table->Columns[0].ClipRect);
|
table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
|
||||||
table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);
|
table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
|
||||||
|
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
|
||||||
|
IM_ASSERT(table->Bg2ClipRectForDrawCmd.Min.y <= table->Bg2ClipRectForDrawCmd.Max.y);
|
||||||
|
|
||||||
|
float row_height = table->RowPosY2 - table->RowPosY1;
|
||||||
|
table->RowPosY2 = window->DC.CursorPos.y = table->WorkRect.Min.y + table->RowPosY2 - table->OuterRect.Min.y;
|
||||||
|
table->RowPosY1 = table->RowPosY2 - row_height;
|
||||||
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||||
|
{
|
||||||
|
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||||
|
column->DrawChannelCurrent = column->DrawChannelUnfrozen;
|
||||||
|
column->ClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y
|
||||||
|
SetWindowClipRectBeforeSetChannel(window, table->Columns[0].ClipRect);
|
||||||
|
table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(table->RowFlags & ImGuiTableRowFlags_Headers))
|
if (!(table->RowFlags & ImGuiTableRowFlags_Headers))
|
||||||
|
Loading…
Reference in New Issue
Block a user