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.
This commit is contained in:
ocornut 2015-07-05 16:32:26 -06:00
parent 0d7ca3da24
commit f04c2002d6

View File

@ -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)