|
@@ -1082,6 +1082,7 @@ static void NavUpdateWindowingOverlay();
|
|
|
static void NavUpdateMoveResult();
|
|
|
static float NavUpdatePageUpPageDown(int allowed_dir_flags);
|
|
|
static inline void NavUpdateAnyRequestFlag();
|
|
|
+static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand);
|
|
|
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, ImGuiID id);
|
|
|
static ImVec2 NavCalcPreferredRefPos();
|
|
|
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
|
|
@@ -3344,12 +3345,6 @@ ImDrawList* ImGui::GetBackgroundDrawList()
|
|
|
return &GImGui->BackgroundDrawList;
|
|
|
}
|
|
|
|
|
|
-static ImDrawList* GetForegroundDrawList(ImGuiWindow*)
|
|
|
-{
|
|
|
- // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.
|
|
|
- return &GImGui->ForegroundDrawList;
|
|
|
-}
|
|
|
-
|
|
|
ImDrawList* ImGui::GetForegroundDrawList()
|
|
|
{
|
|
|
return &GImGui->ForegroundDrawList;
|
|
@@ -7882,7 +7877,7 @@ static void inline NavClampRectToVisibleAreaForMoveDir(ImGuiDir move_dir, ImRect
|
|
|
}
|
|
|
|
|
|
// Scoring function for directional navigation. Based on https://gist.github.com/rygorous/6981057
|
|
|
-static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
|
|
|
+static bool ImGui::NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
@@ -7945,22 +7940,22 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
|
|
|
|
|
|
#if IMGUI_DEBUG_NAV_SCORING
|
|
|
char buf[128];
|
|
|
- if (ImGui::IsMouseHoveringRect(cand.Min, cand.Max))
|
|
|
+ if (IsMouseHoveringRect(cand.Min, cand.Max))
|
|
|
{
|
|
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "dbox (%.2f,%.2f->%.4f)\ndcen (%.2f,%.2f->%.4f)\nd (%.2f,%.2f->%.4f)\nnav %c, quadrant %c", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial, "WENS"[g.NavMoveDir], "WENS"[quadrant]);
|
|
|
- ImDrawList* draw_list = ImGui::GetForegroundDrawList(window);
|
|
|
+ ImDrawList* draw_list = GetForegroundDrawList(window);
|
|
|
draw_list->AddRect(curr.Min, curr.Max, IM_COL32(255,200,0,100));
|
|
|
draw_list->AddRect(cand.Min, cand.Max, IM_COL32(255,255,0,200));
|
|
|
- draw_list->AddRectFilled(cand.Max-ImVec2(4,4), cand.Max+ImGui::CalcTextSize(buf)+ImVec2(4,4), IM_COL32(40,0,0,150));
|
|
|
+ draw_list->AddRectFilled(cand.Max - ImVec2(4,4), cand.Max + CalcTextSize(buf) + ImVec2(4,4), IM_COL32(40,0,0,150));
|
|
|
draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Max, ~0U, buf);
|
|
|
}
|
|
|
else if (g.IO.KeyCtrl) // Hold to preview score in matching quadrant. Press C to rotate.
|
|
|
{
|
|
|
- if (ImGui::IsKeyPressedMap(ImGuiKey_C)) { g.NavMoveDirLast = (ImGuiDir)((g.NavMoveDirLast + 1) & 3); g.IO.KeysDownDuration[g.IO.KeyMap[ImGuiKey_C]] = 0.01f; }
|
|
|
+ if (IsKeyPressedMap(ImGuiKey_C)) { g.NavMoveDirLast = (ImGuiDir)((g.NavMoveDirLast + 1) & 3); g.IO.KeysDownDuration[g.IO.KeyMap[ImGuiKey_C]] = 0.01f; }
|
|
|
if (quadrant == g.NavMoveDir)
|
|
|
{
|
|
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "%.0f/%.0f", dist_box, dist_center);
|
|
|
- ImDrawList* draw_list = ImGui::GetForegroundDrawList(window);
|
|
|
+ ImDrawList* draw_list = GetForegroundDrawList(window);
|
|
|
draw_list->AddRectFilled(cand.Min, cand.Max, IM_COL32(255, 0, 0, 200));
|
|
|
draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Min, IM_COL32(255, 255, 255, 255), buf);
|
|
|
}
|