Browse Source

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
ocornut 2 năm trước cách đây
mục cha
commit
c426e32247

+ 8 - 0
docs/CHANGELOG.txt

@@ -55,6 +55,12 @@ Other changes:
 
 
 - Nav: Tabbing now cycles through all items when ImGuiConfigFlags_NavEnableKeyboard is set.
 - Nav: Tabbing now cycles through all items when ImGuiConfigFlags_NavEnableKeyboard is set.
   (#3092, #5759, #787)
   (#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
 - Nav: Tabbing/Shift-Tabbing can more reliably be used to step out of an item that is not
   tab-stoppable. (#3092, #5759, #787)
   tab-stoppable. (#3092, #5759, #787)
 - Nav: Made Enter key submit the same type of Activation event as Space key,
 - 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)
   result lead to an incorrect calculation and loss of navigation id. (#6171)
 - Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible.
 - Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible.
   (#2814, #2812) [@DomGries]
   (#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)
 - 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
 - InputText: Fixed not being able to use CTRL+Tab while an InputText() using Tab
   for completion or textinput is active (regresion from 1.89).
   for completion or textinput is active (regresion from 1.89).

+ 2 - 0
examples/example_emscripten_wgpu/main.cpp

@@ -127,6 +127,8 @@ static bool InitWGPU()
 
 
 static void MainLoopStep(void* window)
 static void MainLoopStep(void* window)
 {
 {
+    ImGuiIO& io = ImGui::GetIO();
+
     glfwPollEvents();
     glfwPollEvents();
 
 
     int width, height;
     int width, height;

+ 1 - 1
imgui.h

@@ -23,7 +23,7 @@
 // Library Version
 // Library Version
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
 // (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               "1.89.4 WIP"
-#define IMGUI_VERSION_NUM           18936
+#define IMGUI_VERSION_NUM           18937
 #define IMGUI_HAS_TABLE
 #define IMGUI_HAS_TABLE
 
 
 /*
 /*

+ 2 - 5
imgui_tables.cpp

@@ -1999,10 +1999,6 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
     window->WorkRect.Max.x = column->WorkMaxX;
     window->WorkRect.Max.x = column->WorkMaxX;
     window->DC.ItemWidth = column->ItemWidth;
     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;
     window->SkipItems = column->IsSkipItems;
     if (column->IsSkipItems)
     if (column->IsSkipItems)
     {
     {
@@ -2049,7 +2045,8 @@ void ImGui::TableEndCell(ImGuiTable* table)
     else
     else
         p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen;
         p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen;
     *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x);
     *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;
     column->ItemWidth = window->DC.ItemWidth;
 
 
     // Propagate text baseline for the entire row
     // Propagate text baseline for the entire row