mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
Tables: another attempt at making contents not overlap the bottom and right border in a scrolling table. (#6765, #3752, #7428)
This commit is contained in:
parent
a131c3e611
commit
864a2bf6b8
@ -80,8 +80,9 @@ Other changes:
|
|||||||
payload over an already open tree node would incorrectly select it. (#7850)
|
payload over an already open tree node would incorrectly select it. (#7850)
|
||||||
- MultiSelect+TreeNode: default open behavior is OpenOnDoubleClick + OpenOnArrow
|
- MultiSelect+TreeNode: default open behavior is OpenOnDoubleClick + OpenOnArrow
|
||||||
when used in a multi-select context without any OpenOnXXX flags set. (#7850)
|
when used in a multi-select context without any OpenOnXXX flags set. (#7850)
|
||||||
- Tables: revert 1.90 extension of bottom-most and right-most outer border offset by one.
|
- Tables: fixes/revert a 1.90 change were outer border would be moved bottom and right
|
||||||
This is not the right solution. (#6765, #3752)
|
by an extra pixel + rework the change so that contents doesn't overlap the bottom and
|
||||||
|
right border in a scrolling table. (#6765, #3752, #7428)
|
||||||
- InputText: allow callback to update buffer while in read-only mode. (imgui_club/#46)
|
- InputText: allow callback to update buffer while in read-only mode. (imgui_club/#46)
|
||||||
- InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)
|
- InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)
|
||||||
- TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)
|
- TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)
|
||||||
|
@ -460,16 +460,27 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
temp_data->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size;
|
temp_data->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size;
|
||||||
inner_window->DC.PrevLineSize = inner_window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
|
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)
|
// Make borders not overlap our contents by offsetting HostClipRect (#6765, #7428, #3752)
|
||||||
// (we normally shouldn't alter HostClipRect as we rely on TableMergeDrawChannels() expanding non-clipped column toward the
|
// (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
|
// 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).
|
// problem only affect scrolling tables in this case we can get away with doing it without extra cost).
|
||||||
if (inner_window != outer_window)
|
if (inner_window != outer_window)
|
||||||
{
|
{
|
||||||
|
// FIXME: Because inner_window's Scrollbar doesn't know about border size, since it's not encoded in window->WindowBorderSize,
|
||||||
|
// it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with
|
||||||
|
// different x/y values to BeginChild().
|
||||||
if (flags & ImGuiTableFlags_BordersOuterV)
|
if (flags & ImGuiTableFlags_BordersOuterV)
|
||||||
|
{
|
||||||
table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + TABLE_BORDER_SIZE, table->HostClipRect.Max.x);
|
table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + TABLE_BORDER_SIZE, table->HostClipRect.Max.x);
|
||||||
|
if (inner_window->DecoOuterSizeX2 == 0.0f)
|
||||||
|
table->HostClipRect.Max.x = ImMax(table->HostClipRect.Max.x - TABLE_BORDER_SIZE, table->HostClipRect.Min.x);
|
||||||
|
}
|
||||||
if (flags & ImGuiTableFlags_BordersOuterH)
|
if (flags & ImGuiTableFlags_BordersOuterH)
|
||||||
|
{
|
||||||
table->HostClipRect.Min.y = ImMin(table->HostClipRect.Min.y + TABLE_BORDER_SIZE, table->HostClipRect.Max.y);
|
table->HostClipRect.Min.y = ImMin(table->HostClipRect.Min.y + TABLE_BORDER_SIZE, table->HostClipRect.Max.y);
|
||||||
|
if (inner_window->DecoOuterSizeY2 == 0.0f)
|
||||||
|
table->HostClipRect.Max.y = ImMax(table->HostClipRect.Max.y - TABLE_BORDER_SIZE, table->HostClipRect.Min.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Padding and Spacing
|
// Padding and Spacing
|
||||||
@ -497,7 +508,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect;
|
table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect;
|
||||||
table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width
|
table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width
|
||||||
table->InnerClipRect.ClipWithFull(table->HostClipRect);
|
table->InnerClipRect.ClipWithFull(table->HostClipRect);
|
||||||
table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : inner_window->ClipRect.Max.y;
|
table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : table->HostClipRect.Max.y;
|
||||||
|
|
||||||
table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow
|
table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow
|
||||||
table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()
|
table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()
|
||||||
@ -1249,7 +1260,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
if (table->Flags & ImGuiTableFlags_NoClip)
|
if (table->Flags & ImGuiTableFlags_NoClip)
|
||||||
table->DrawSplitter->SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
table->DrawSplitter->SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
||||||
else
|
else
|
||||||
inner_window->DrawList->PushClipRect(inner_window->ClipRect.Min, inner_window->ClipRect.Max, false);
|
inner_window->DrawList->PushClipRect(inner_window->InnerClipRect.Min, inner_window->InnerClipRect.Max, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process hit-testing on resizing borders. Actual size change will be applied in EndTable()
|
// Process hit-testing on resizing borders. Actual size change will be applied in EndTable()
|
||||||
|
Loading…
Reference in New Issue
Block a user