Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change (c5d83d8a). It's not incorrect but it breaks existing some layout patterns. Will return back to it when we expose Separator flags.

This commit is contained in:
omar 2019-05-09 17:52:56 +02:00
parent e29176df53
commit 9534ef9b26
2 changed files with 9 additions and 4 deletions

View File

@ -37,6 +37,8 @@ Breaking Changes:
Other Changes: Other Changes:
- Columns: Fixed Separator from creating an extraneous draw command. (#125) - Columns: Fixed Separator from creating an extraneous draw command. (#125)
- Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125) - Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)
- Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change. It's not incorrect
but it breaks existing some layout patterns. Will return back to it when we expose Separator flags.
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -1207,13 +1207,15 @@ void ImGui::SeparatorEx(ImGuiSeparatorFlags flags)
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected
float thickness_draw = 1.0f;
float thickness_layout = 0.0f;
if (flags & ImGuiSeparatorFlags_Vertical) if (flags & ImGuiSeparatorFlags_Vertical)
{ {
// Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout. // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.
float y1 = window->DC.CursorPos.y; float y1 = window->DC.CursorPos.y;
float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y; float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y;
const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2)); const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness_draw, y2));
ItemSize(ImVec2(1.0f, 0.0f)); ItemSize(ImVec2(thickness_layout, 0.0f));
if (!ItemAdd(bb, 0)) if (!ItemAdd(bb, 0))
return; return;
@ -1234,8 +1236,9 @@ void ImGui::SeparatorEx(ImGuiSeparatorFlags flags)
if (columns) if (columns)
PushColumnsBackground(); PushColumnsBackground();
const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + 1.0f)); // We don't provide our width to the layout so that it doesn't get feed back into AutoFit
ItemSize(ImVec2(0.0f, 1.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness_draw));
ItemSize(ImVec2(0.0f, thickness_layout));
if (!ItemAdd(bb, 0)) if (!ItemAdd(bb, 0))
{ {
if (columns) if (columns)