mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08: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:
parent
b443bc0a64
commit
c37f21788f
@ -64,6 +64,8 @@ Other Changes:
|
||||
- Columns: Improved honoring alignment with various values of ItemSpacing.x and WindowPadding.x. (#125, #2666)
|
||||
- Word-wrapping: Fixed overzealous word-wrapping when glyph edge lands exactly on the limit. Because
|
||||
of this, auto-fitting exactly unwrapped text would make it wrap. (fixes initial 1.15 commit, 78645a7d).
|
||||
- Columns: Made GetColumnOffset() and GetColumnWidth() behave when there's no column set, consistently with
|
||||
other column functions. (#2683)
|
||||
- Scrolling: Added SetScrollHereX(), SetScrollFromPosX() for completeness. (#1580) [@kevreco]
|
||||
- Style: Attenuated default opacity of ImGuiCol_Separator in Classic and Light styles.
|
||||
- Style: Added style.ColorButtonPosition (left/right, defaults to ImGuiDir_Right) to move the color button
|
||||
|
@ -2593,7 +2593,9 @@ static void ShowDemoWindowColumns()
|
||||
static int columns_count = 4;
|
||||
const int lines_count = 3;
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||
ImGui::DragInt("##columns_count", &columns_count, 0.1f, 1, 10, "%d columns");
|
||||
ImGui::DragInt("##columns_count", &columns_count, 0.1f, 2, 10, "%d columns");
|
||||
if (columns_count < 2)
|
||||
columns_count = 2;
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("horizontal", &h_borders);
|
||||
ImGui::SameLine();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user