mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Columns: Made GetColumnOffset() and GetColumnWidth() behave when there's no column set, consistently with other column functions + fixed Columns demo (#2683)
This commit is contained in:
@ -7152,7 +7152,8 @@ float ImGui::GetColumnOffset(int column_index)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
ImGuiColumns* columns = window->DC.CurrentColumns;
|
||||
IM_ASSERT(columns != NULL);
|
||||
if (columns == NULL)
|
||||
return 0.0f;
|
||||
|
||||
if (column_index < 0)
|
||||
column_index = columns->Current;
|
||||
@ -7178,9 +7179,11 @@ static float GetColumnWidthEx(ImGuiColumns* columns, int column_index, bool befo
|
||||
|
||||
float ImGui::GetColumnWidth(int column_index)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImGuiColumns* columns = window->DC.CurrentColumns;
|
||||
IM_ASSERT(columns != NULL);
|
||||
if (columns == NULL)
|
||||
return GetContentRegionAvail().x;
|
||||
|
||||
if (column_index < 0)
|
||||
column_index = columns->Current;
|
||||
|
Reference in New Issue
Block a user