Nav: Added NavMoveResultParentId internal info to record when the parent/context of a given NavId. Useful for various algorithms (currently looking at range selection stuff) (#787)

docking
omar 7 years ago
parent 74da533c93
commit 64a51327d3

@ -2220,6 +2220,7 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar
if (new_best) if (new_best)
{ {
g.NavMoveResultId = *id; g.NavMoveResultId = *id;
g.NavMoveResultParentId = window->IDStack.back();
g.NavMoveResultRectRel = nav_bb_rel; g.NavMoveResultRectRel = nav_bb_rel;
} }
@ -2856,6 +2857,7 @@ static void NavUpdate()
// Reset search // Reset search
g.NavMoveResultId = 0; g.NavMoveResultId = 0;
g.NavMoveResultParentId = 0;
g.NavMoveResultDistAxial = g.NavMoveResultDistBox = g.NavMoveResultDistCenter = FLT_MAX; g.NavMoveResultDistAxial = g.NavMoveResultDistBox = g.NavMoveResultDistCenter = FLT_MAX;
// When we have manually scrolled (without using navigation) and NavId becomes out of bounds, we clamp its bounding box (used for search) to the visible area to restart navigation within visible items // When we have manually scrolled (without using navigation) and NavId becomes out of bounds, we clamp its bounding box (used for search) to the visible area to restart navigation within visible items

@ -480,6 +480,7 @@ struct ImGuiContext
ImGuiDir NavMoveDir; // West/East/North/South ImGuiDir NavMoveDir; // West/East/North/South
ImGuiDir NavMoveDirLast; // ImGuiDir NavMoveDirLast; //
ImGuiID NavMoveResultId; // Best move request candidate ImGuiID NavMoveResultId; // Best move request candidate
ImGuiID NavMoveResultParentId; //
float NavMoveResultDistBox; // Best move request candidate box distance to current NavId float NavMoveResultDistBox; // Best move request candidate box distance to current NavId
float NavMoveResultDistCenter; // Best move request candidate center distance to current NavId float NavMoveResultDistCenter; // Best move request candidate center distance to current NavId
float NavMoveResultDistAxial; float NavMoveResultDistAxial;
@ -590,6 +591,7 @@ struct ImGuiContext
NavMoveRequestForwardStep = 0; NavMoveRequestForwardStep = 0;
NavMoveDir = NavMoveDirLast = ImGuiDir_None; NavMoveDir = NavMoveDirLast = ImGuiDir_None;
NavMoveResultId = 0; NavMoveResultId = 0;
NavMoveResultParentId = 0;
NavMoveResultDistBox = NavMoveResultDistCenter = NavMoveResultDistAxial = 0.0f; NavMoveResultDistBox = NavMoveResultDistCenter = NavMoveResultDistAxial = 0.0f;
SetNextWindowPosVal = ImVec2(0.0f, 0.0f); SetNextWindowPosVal = ImVec2(0.0f, 0.0f);

Loading…
Cancel
Save