1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Columns: Fixed a regression from 1.71 where the right-side of the contents rectangle within each column would wrongly use a WindowPadding.x instead of ItemSpacing.x like it always did. (#125, #2666)

This commit is contained in:
omar 2019-07-17 17:09:47 -07:00
parent 61c7f0194e
commit e28d20c3e2
2 changed files with 12 additions and 6 deletions

View File

@ -56,6 +56,8 @@ Other Changes:
- Scrollbar: Avoid overlapping the opposite side when window (often a child window) is forcibly too small.
- Combo: Hide arrow when there's not enough space even for the square button.
- TabBar: Fixed unfocused tab bar separator color (was using ImGuiCol_Tab, should use ImGuiCol_TabUnfocusedActive).
- Columns: Fixed a regression from 1.71 where the right-side of the contents rectangle within each column
would wrongly use a WindowPadding.x instead of ItemSpacing.x like it always did. (#125, #2666)
- Word-wrapping: Fixed overzealous word-wrapping when glyph edge lands exactly on the limit. Because
of this, auto-fitting exactly unwrapped text would make it wrap. (fixes initial 1.15 commit, 78645a7d).
- Scrolling: Added SetScrollHereX(), SetScrollFromPosX() for completeness. (#1580) [@kevreco]

View File

@ -7295,8 +7295,10 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
window->DC.CurrentColumns = columns;
// Set state for first column
columns->OffMinX = window->DC.Indent.x - g.Style.ItemSpacing.x;
columns->OffMaxX = ImMax(window->WorkRect.Max.x - window->Pos.x, columns->OffMinX + 1.0f);
const float column_padding = g.Style.ItemSpacing.x;
columns->OffMinX = window->DC.Indent.x - column_padding;
columns->OffMaxX = window->WorkRect.Max.x - window->Pos.x;
columns->OffMaxX = ImMax(columns->OffMaxX, columns->OffMinX + 1.0f);
columns->HostCursorPosY = window->DC.CursorPos.y;
columns->HostCursorMaxPosX = window->DC.CursorMaxPos.x;
columns->HostClipRect = window->ClipRect;
@ -7343,7 +7345,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
float offset_1 = GetColumnOffset(columns->Current + 1);
float width = offset_1 - offset_0;
PushItemWidth(width * 0.65f);
window->WorkRect.Max.x = window->Pos.x + offset_1 - window->WindowPadding.x;
window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
}
void ImGui::NextColumn()
@ -7364,17 +7366,19 @@ void ImGui::NextColumn()
PopItemWidth();
PopClipRect();
const float column_padding = g.Style.ItemSpacing.x;
columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
if (++columns->Current < columns->Count)
{
// Columns 1+ cancel out IndentX
// Columns 1+ ignore IndentX (by canceling it out)
// FIXME-COLUMNS: Unnecessary, could be locked?
window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + g.Style.ItemSpacing.x;
window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + column_padding;
window->DrawList->ChannelsSetCurrent(columns->Current + 1);
}
else
{
// New row/line
// Column 0 honor IndentX
window->DC.ColumnsOffset.x = 0.0f;
window->DrawList->ChannelsSetCurrent(1);
columns->Current = 0;
@ -7392,7 +7396,7 @@ void ImGui::NextColumn()
float offset_1 = GetColumnOffset(columns->Current + 1);
float width = offset_1 - offset_0;
PushItemWidth(width * 0.65f);
window->WorkRect.Max.x = window->Pos.x + offset_1 - window->WindowPadding.x;
window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
}
void ImGui::EndColumns()