From c5d83d8af205618d950527625838377a9853b3b8 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 26 Apr 2019 22:25:30 +0200 Subject: [PATCH] Separator: Declare its thickness (1.0f) to the layout, making items around separator more symmetrical. --- docs/CHANGELOG.txt | 3 ++- imgui_widgets.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index dbe87c97..c51fcc0e 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -62,7 +62,8 @@ Other Changes: - GetMouseDragDelta(): verify that mouse positions are valid otherwise returns zero. - Inputs: Also add support for horizontal scroll with Shift+Mouse Wheel. (#2424, #1463) [@LucaRood] - PlotLines, PlotHistogram: Ignore NaN values when calculating min/max bounds. (#2485) -- Columns: Fixed boundary of clipping being off by 1 pixel within the left column. +- Columns: Fixed boundary of clipping being off by 1 pixel within the left column. (#125) +- Separator: Declare its thickness (1.0f) to the layout, making items around separator more symmetrical. - Combo, Slider, Scrollbar: Improve rendering in situation when there's only a few pixels available (<3 pixels). - Nav: Fixed Drag/Slider functions going into text input mode when keyboard CTRL is held while pressing NavActivate. - Misc: Added IM_MALLOC/IM_FREE macros mimicking IM_NEW/IM_DELETE so user doesn't need to revert diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index bebbf3d8..82bef8fb 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1203,7 +1203,7 @@ void ImGui::Separator() return; ImGuiContext& g = *GImGui; - // Those flags should eventually be overridable by the user + // Those flags should eventually be overrideable by the user ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal; IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected if (flags & ImGuiSeparatorFlags_Vertical) @@ -1222,7 +1222,7 @@ void ImGui::Separator() x1 += window->DC.Indent.x; const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f)); - ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout. + ItemSize(ImVec2(0.0f, 1.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit if (!ItemAdd(bb, 0)) { if (window->DC.CurrentColumns) @@ -1252,7 +1252,7 @@ void ImGui::VerticalSeparator() float y1 = window->DC.CursorPos.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)); - ItemSize(ImVec2(bb.GetWidth(), 0.0f)); + ItemSize(ImVec2(1.0f, 0.0f)); if (!ItemAdd(bb, 0)) return;