Browse Source

Nav: prevent child from clipping items when using _NavFlattened and parent has a pending nav request. (#787)

ocornut 3 years ago
parent
commit
e790fc0e79
2 changed files with 5 additions and 1 deletions
  1. 1 0
      docs/CHANGELOG.txt
  2. 4 1
      imgui.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -50,6 +50,7 @@ Other Changes:
 - Nav: tabbing now cycles through clipped items and scroll accordingly. (#4449)
 - Nav: tabbing now cycles through clipped items and scroll accordingly. (#4449)
 - Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer.
 - Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer.
 - Nav: fixed resizing window from borders setting navigation to Menu layer.
 - Nav: fixed resizing window from borders setting navigation to Menu layer.
+- Nav: prevent child from clipping items when using _NavFlattened and parent has a pending request.
 - Nav: pressing Esc to exit a child window reactivates the Nav highlight if it was disabled by mouse.
 - Nav: pressing Esc to exit a child window reactivates the Nav highlight if it was disabled by mouse.
 - Nav: with ImGuiConfigFlags_NavEnableSetMousePos enabled: Fixed absolute mouse position when using
 - Nav: with ImGuiConfigFlags_NavEnableSetMousePos enabled: Fixed absolute mouse position when using
   Home/End leads to scrolling. Fixed not setting mouse position when a failed move request (e.g. when
   Home/End leads to scrolling. Fixed not setting mouse position when a failed move request (e.g. when

+ 4 - 1
imgui.cpp

@@ -6403,9 +6403,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
             // Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
             // Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
             IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
             IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
             if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) // FIXME: Doesn't make sense for ChildWindow??
             if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) // FIXME: Doesn't make sense for ChildWindow??
-                if (!g.LogEnabled)
+            {
+                const bool nav_request = (flags & ImGuiWindowFlags_NavFlattened) && (g.NavAnyRequest && g.NavWindow && g.NavWindow->RootWindowForNav == window->RootWindowForNav);
+                if (!g.LogEnabled && !nav_request)
                     if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y)
                     if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y)
                         window->HiddenFramesCanSkipItems = 1;
                         window->HiddenFramesCanSkipItems = 1;
+            }
 
 
             // Hide along with parent or if parent is collapsed
             // Hide along with parent or if parent is collapsed
             if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCanSkipItems > 0))
             if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCanSkipItems > 0))