mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Nav: Internals: Renamed RootNavWindow to NavRootWindow (#787)
This commit is contained in:
parent
72485a5d04
commit
c8d8dc7f0a
21
imgui.cpp
21
imgui.cpp
@ -1906,9 +1906,6 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;
|
||||
SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);
|
||||
|
||||
NavLastIds[0] = NavLastIds[1] = 0;
|
||||
NavRectRel[0] = NavRectRel[1] = ImRect();
|
||||
|
||||
LastFrameActive = -1;
|
||||
ItemWidthDefault = 0.0f;
|
||||
FontWindowScale = 1.0f;
|
||||
@ -1918,7 +1915,10 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
||||
ParentWindow = NULL;
|
||||
RootWindow = NULL;
|
||||
RootNonPopupWindow = NULL;
|
||||
RootNavWindow = NULL;
|
||||
|
||||
NavRootWindow = NULL;
|
||||
NavLastIds[0] = NavLastIds[1] = 0;
|
||||
NavRectRel[0] = NavRectRel[1] = ImRect();
|
||||
|
||||
FocusIdxAllCounter = FocusIdxTabCounter = -1;
|
||||
FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX;
|
||||
@ -2333,7 +2333,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg)
|
||||
// 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.NavInitRequest) 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)
|
||||
window->DC.NavLayerActiveMaskNext |= window->DC.NavLayerCurrentMask;
|
||||
if (g.NavWindow == window->RootNavWindow)
|
||||
if (g.NavWindow == window->NavRootWindow)
|
||||
if (g.NavId == id || g.NavAnyRequest)
|
||||
NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb, id);
|
||||
}
|
||||
@ -2885,9 +2885,10 @@ static void ImGui::NavUpdate()
|
||||
// Process navigation move request
|
||||
if (g.NavMoveRequest && g.NavMoveResult.ID != 0)
|
||||
{
|
||||
// Scroll to keep newly navigated item fully into view
|
||||
ImGuiNavMoveResult* result = &g.NavMoveResult;
|
||||
IM_ASSERT(g.NavWindow && result->Window);
|
||||
|
||||
// Scroll to keep newly navigated item fully into view
|
||||
if (g.NavLayer == 0)
|
||||
NavScrollToBringItemIntoView(result->Window, result->RectRel);
|
||||
|
||||
@ -5527,9 +5528,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->RootWindow = parent_window->RootWindow;
|
||||
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||
window->RootNonPopupWindow = parent_window->RootNonPopupWindow;
|
||||
window->RootNavWindow = window;
|
||||
//while (window->RootNavWindow->Flags & ImGuiWindowFlags_NavFlattened)
|
||||
// window->RootNavWindow = window->RootNavWindow->ParentWindow;
|
||||
window->NavRootWindow = window;
|
||||
//while (window->NavRootWindow->Flags & ImGuiWindowFlags_NavFlattened)
|
||||
// window->NavRootWindow = window->NavRootWindow->ParentWindow;
|
||||
|
||||
window->Active = true;
|
||||
window->BeginOrderWithinParent = 0;
|
||||
@ -7036,7 +7037,7 @@ void ImGui::SetItemDefaultFocus()
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (!window->Appearing)
|
||||
return;
|
||||
if (g.NavWindow == window->RootNavWindow && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == g.NavWindow->DC.NavLayerCurrent)
|
||||
if (g.NavWindow == window->NavRootWindow && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == g.NavWindow->DC.NavLayerCurrent)
|
||||
{
|
||||
g.NavInitRequest = false;
|
||||
g.NavInitResultExplicit = true;
|
||||
|
@ -511,7 +511,7 @@ struct ImGuiNavMoveResult
|
||||
ImGuiWindow* Window; // Best candidate window
|
||||
float DistBox; // Best candidate box distance to current NavId
|
||||
float DistCenter; // Best candidate center distance to current NavId
|
||||
float DistAxial; // Best candidate selected distance (box/center) to current NavId
|
||||
float DistAxial;
|
||||
ImRect RectRel; // Best candidate bounding box in window relative space
|
||||
|
||||
ImGuiNavMoveResult() { ID = ParentID = 0; Window = NULL; DistBox = DistCenter = DistAxial = 0.0f; }
|
||||
@ -921,9 +921,6 @@ struct IMGUI_API ImGuiWindow
|
||||
ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
|
||||
ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right.
|
||||
|
||||
ImGuiID NavLastIds[2]; // Last known NavId for this window, per layer (0/1)
|
||||
ImRect NavRectRel[2]; // Reference rectangle, in window relative space
|
||||
|
||||
ImGuiDrawContext DC; // Temporary per-window data, reset at the beginning of the frame
|
||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
||||
ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
||||
@ -939,7 +936,10 @@ struct IMGUI_API ImGuiWindow
|
||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
||||
ImGuiWindow* RootWindow; // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window.
|
||||
ImGuiWindow* RootNonPopupWindow; // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
||||
ImGuiWindow* RootNavWindow; // Generally point to ourself. If we are a child window with the ImGuiWindowFlags_NavFlattenedChild flag, point to parent. Used to display TitleBgActive color and for selecting which window to use for NavWindowing.
|
||||
|
||||
ImGuiWindow* NavRootWindow; // Generally point to ourself. If we are a child window with the NavFlattened flag, point to a parent window.
|
||||
ImGuiID NavLastIds[2]; // Last known NavId for this window, per layer (0/1)
|
||||
ImRect NavRectRel[2]; // Reference rectangle, in window relative space
|
||||
|
||||
// Navigation / Focus
|
||||
// FIXME-NAV: Merge all this with the new Nav system, at least the request variables should be moved to ImGuiContext
|
||||
|
Loading…
Reference in New Issue
Block a user