From e12cfa9dfd8ae80f70f8229f6510e225bee1fe68 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 6 Oct 2017 09:44:50 -0700 Subject: [PATCH] Nav: Minor midying up and comments, --- imgui.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 15007e50..bfba93ea 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2228,19 +2228,19 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar window->DC.LastItemId = id ? *id : 0; window->DC.LastItemRect = bb; window->DC.LastItemRectHoveredRect = false; - if (id != NULL) - window->DC.NavLayerActiveMaskNext |= (1 << window->DC.NavLayerCurrent); // Navigation processing runs prior to clipping early-out // (a) So that NavInitDefaultRequest can be honored, for newly opened windows to select a default widget // (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests unfortunately, but it is still limited to one window. - // it may not scale very well for windows with ten of thousands of item, but at least the NavRequest is only performed on user interaction, aka maximum once a frame. + // it may not scale very well for windows with ten of thousands of item, but at least NavMoveRequest is only set on user interaction, aka maximum once a frame. // We could early out with `if (is_clipped && !g.NavInitDefaultRequest) return false;` but when we wouldn't be able to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick) - // A more pragmatic solution for handling long lists is relying on the fact that they are likely evenly spread items (so that clipper can be used) and we could Nav at higher-level (apply index, etc.) - // So eventually we would like to provide the user will the primitives to be able to implement that customized/efficient navigation handling whenever necessary. - if (id != NULL && g.NavWindow == window->RootNavWindow) - if (g.NavId == *id || g.NavMoveRequest || g.NavInitDefaultRequest || IMGUI_DEBUG_NAV) - NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb, *id); + if (id != NULL) + { + window->DC.NavLayerActiveMaskNext |= (1 << window->DC.NavLayerCurrent); + if (g.NavWindow == window->RootNavWindow) + if (g.NavId == *id || g.NavMoveRequest || g.NavInitDefaultRequest || IMGUI_DEBUG_NAV) + NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb, *id); + } if (is_clipped) return false;