mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 00:09:55 +02:00
Tables: Fixed top-most and left-most outer border overlapping inner clip-rect when scrolling. (#6765)
This commit is contained in:
@ -445,6 +445,18 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
temp_data->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size;
|
||||
inner_window->DC.PrevLineSize = inner_window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
|
||||
|
||||
// Make left and top borders not overlap our contents by offsetting HostClipRect (#6765)
|
||||
// (we normally shouldn't alter HostClipRect as we rely on TableMergeDrawChannels() expanding non-clipped column toward the
|
||||
// limits of that rectangle, in order for ImDrawListSplitter::Merge() to merge the draw commands. However since the overlap
|
||||
// problem only affect scrolling tables in this case we can get away with doing it without extra cost).
|
||||
if (inner_window != outer_window)
|
||||
{
|
||||
if (flags & ImGuiTableFlags_BordersOuterV)
|
||||
table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + TABLE_BORDER_SIZE, table->HostClipRect.Max.x);
|
||||
if (flags & ImGuiTableFlags_BordersOuterH)
|
||||
table->HostClipRect.Min.y = ImMin(table->HostClipRect.Min.y + TABLE_BORDER_SIZE, table->HostClipRect.Max.y);
|
||||
}
|
||||
|
||||
// Padding and Spacing
|
||||
// - None ........Content..... Pad .....Content........
|
||||
// - PadOuter | Pad ..Content..... Pad .....Content.. Pad |
|
||||
@ -1149,7 +1161,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
||||
table->InnerClipRect.Max.x = ImMin(table->InnerClipRect.Max.x, unused_x1);
|
||||
}
|
||||
table->InnerWindow->ParentWorkRect = table->WorkRect;
|
||||
table->BorderX1 = table->InnerClipRect.Min.x + ((table->Flags & ImGuiTableFlags_BordersOuterV) ? 1.0f : 0.0f);
|
||||
table->BorderX1 = table->InnerClipRect.Min.x;
|
||||
table->BorderX2 = table->InnerClipRect.Max.x;
|
||||
|
||||
// Setup window's WorkRect.Max.y for GetContentRegionAvail(). Other values will be updated in each TableBeginCell() call.
|
||||
|
Reference in New Issue
Block a user