From f04c2002d608498b4655145c7e594b6be6d32cde Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 5 Jul 2015 16:32:26 -0600 Subject: [PATCH] AA branch: fixed column offsets not always aligned to the pixel causing CollapsingHeader() border to incorrectly anti-alias Fixing framed CollapsingHeader() inside columns, where GetContentRegionMax() doesn't return pixel aligned rounded position. --- imgui.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 866848bb..8e7e80be 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8676,11 +8676,10 @@ static float GetDraggedColumnOffset(int column_index) IM_ASSERT(column_index > 0); // We cannot drag column 0. If you get this assert you may have a conflict between the ID of your columns and another widgets. IM_ASSERT(g.ActiveId == window->DC.ColumnsSetID + ImGuiID(column_index)); - float x = g.IO.MousePos.x + g.ActiveClickDeltaToCenter.x; - x -= window->Pos.x; + float x = g.IO.MousePos.x + g.ActiveClickDeltaToCenter.x - window->Pos.x; x = ImClamp(x, ImGui::GetColumnOffset(column_index-1)+g.Style.ColumnsMinSpacing, ImGui::GetColumnOffset(column_index+1)-g.Style.ColumnsMinSpacing); - return x; + return (float)(int)x; } float ImGui::GetColumnOffset(int column_index) @@ -8703,8 +8702,8 @@ float ImGui::GetColumnOffset(int column_index) const float min_x = window->DC.ColumnsStartX; const float max_x = window->Size.x - (g.Style.ScrollbarWidth);// - window->WindowPadding().x; - const float offset = min_x + t * (max_x - min_x); - return offset; + const float x = min_x + t * (max_x - min_x); + return (float)(int)x; } void ImGui::SetColumnOffset(int column_index, float offset)