1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-28 17:40:56 +01:00

Columns: never assume horizontal space for scrollbar if NoScrollbar flag is set.

This commit is contained in:
ocornut 2015-07-30 12:32:20 -06:00
parent fc9ee2bc9b
commit fddc871870

View File

@ -8787,7 +8787,7 @@ float ImGui::GetColumnOffset(int column_index)
const float t = window->DC.ColumnsOffsetsT[column_index]; const float t = window->DC.ColumnsOffsetsT[column_index];
const float min_x = window->DC.ColumnsStartX; const float min_x = window->DC.ColumnsStartX;
const float max_x = window->Size.x - (g.Style.ScrollbarWidth);// - window->WindowPadding().x; const float max_x = window->Size.x - ((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarWidth);// - window->WindowPadding().x;
const float x = min_x + t * (max_x - min_x); const float x = min_x + t * (max_x - min_x);
return (float)(int)x; return (float)(int)x;
} }
@ -8803,7 +8803,7 @@ void ImGui::SetColumnOffset(int column_index, float offset)
const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index); const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
const float min_x = window->DC.ColumnsStartX; const float min_x = window->DC.ColumnsStartX;
const float max_x = window->Size.x - (g.Style.ScrollbarWidth);// - window->WindowPadding().x; const float max_x = window->Size.x - ((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarWidth);// - window->WindowPadding().x;
const float t = (offset - min_x) / (max_x - min_x); const float t = (offset - min_x) / (max_x - min_x);
window->DC.StateStorage->SetFloat(column_id, t); window->DC.StateStorage->SetFloat(column_id, t);
window->DC.ColumnsOffsetsT[column_index] = t; window->DC.ColumnsOffsetsT[column_index] = t;