From c426e322470f4e1577b620150c8aa865fb5c1632 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 13 Mar 2023 16:23:45 +0100 Subject: [PATCH] Tables: Fixed an issue where user's Y cursor movement within a hidden column would have side-effects. - Afaik the "to allow ImGuiListClipper to function" was added early during Tables development (prior to commit 55) and later replaced by support in ImGuiListCipper, it seems unnecessary. - Also removed RowPosY2 being accted in TableEndCell(). + Comments about 2bb9e35 + fix example bb224c8 --- docs/CHANGELOG.txt | 8 ++++++++ examples/example_emscripten_wgpu/main.cpp | 2 ++ imgui.h | 2 +- imgui_tables.cpp | 7 ++----- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e4638cc5..7b5aeff4 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -55,6 +55,12 @@ Other changes: - Nav: Tabbing now cycles through all items when ImGuiConfigFlags_NavEnableKeyboard is set. (#3092, #5759, #787) + While this was generally desired and requested by many, note that its addition means + that some types of UI may become more fastidious to use TAB key with, if the navigation + cursor cycles through too many items. You can mark items items as not tab-spottable: + - Public API: PushTabStop(false) / PopTabStop() + - Internal: PushItemFlag(ImGuiItemFlags_NoTabStop, true); + - Internal: Directly pass ImGuiItemFlags_NoTabStop to ItemAdd() for custom widgets. - Nav: Tabbing/Shift-Tabbing can more reliably be used to step out of an item that is not tab-stoppable. (#3092, #5759, #787) - Nav: Made Enter key submit the same type of Activation event as Space key, @@ -66,6 +72,8 @@ Other changes: result lead to an incorrect calculation and loss of navigation id. (#6171) - Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible. (#2814, #2812) [@DomGries] +- Tables: Fixed an issue where user's Y cursor movement within a hidden column would + have side-effects. - IO: Lifted constraint to call io.AddEventXXX functions from current context. (#4921, #5856, #6199) - InputText: Fixed not being able to use CTRL+Tab while an InputText() using Tab for completion or textinput is active (regresion from 1.89). diff --git a/examples/example_emscripten_wgpu/main.cpp b/examples/example_emscripten_wgpu/main.cpp index 265e84dc..729e759d 100644 --- a/examples/example_emscripten_wgpu/main.cpp +++ b/examples/example_emscripten_wgpu/main.cpp @@ -127,6 +127,8 @@ static bool InitWGPU() static void MainLoopStep(void* window) { + ImGuiIO& io = ImGui::GetIO(); + glfwPollEvents(); int width, height; diff --git a/imgui.h b/imgui.h index 66fda139..0fd3ce28 100644 --- a/imgui.h +++ b/imgui.h @@ -23,7 +23,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') #define IMGUI_VERSION "1.89.4 WIP" -#define IMGUI_VERSION_NUM 18936 +#define IMGUI_VERSION_NUM 18937 #define IMGUI_HAS_TABLE /* diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 7b2671c0..0c247fa0 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1999,10 +1999,6 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) window->WorkRect.Max.x = column->WorkMaxX; window->DC.ItemWidth = column->ItemWidth; - // To allow ImGuiListClipper to function we propagate our row height - if (!column->IsEnabled) - window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2); - window->SkipItems = column->IsSkipItems; if (column->IsSkipItems) { @@ -2049,7 +2045,8 @@ void ImGui::TableEndCell(ImGuiTable* table) else p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen; *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x); - table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); + if (column->IsEnabled) + table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); column->ItemWidth = window->DC.ItemWidth; // Propagate text baseline for the entire row