From 6ab5fd1da9600a8f17f8469691a105663511678b Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 18 Jul 2022 17:40:52 +0200 Subject: [PATCH] Tables,Columns: fixed a layout issue where SameLine() prior to a row change would set the next row in such state where subsequent SameLine() would move back to previous row. --- docs/CHANGELOG.txt | 2 ++ imgui.h | 2 +- imgui_tables.cpp | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0b665e215..6fa0f4d07 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -56,6 +56,8 @@ Other Changes: - InputText: added experimental io.ConfigInputTextEnterKeepActive feature to make pressing Enter keep the input active and select all text. +- Tables,Columns: fixed a layout issue where SameLine() prior to a row change would set the + next row in such state where subsequent SameLine() would move back to previous row. - IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey can apply to mouse data as well. (#4921) - Nav: Fixed moving/resizing window with gamepad or keyboard when running at very high framerate. diff --git a/imgui.h b/imgui.h index a23904474..ce0856930 100644 --- a/imgui.h +++ b/imgui.h @@ -65,7 +65,7 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.89 WIP" -#define IMGUI_VERSION_NUM 18804 +#define IMGUI_VERSION_NUM 18805 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 9b18f41d4..80ae61376 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1717,6 +1717,8 @@ void ImGui::TableBeginRow(ImGuiTable* table) table->RowTextBaseline = 0.0f; table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent window->DC.PrevLineTextBaseOffset = 0.0f; + window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); + window->DC.IsSameLine = false; window->DC.CursorMaxPos.y = next_y1; // Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging. @@ -3957,6 +3959,7 @@ void ImGui::NextColumn() { // New row/line: column 0 honor IndentX. window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f); + window->DC.IsSameLine = false; columns->LineMinY = columns->LineMaxY; } window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);