mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui_internal.h
This commit is contained in:
		
							
								
								
									
										13
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -1094,6 +1094,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);
 | 
			
		||||
@@ -8626,7 +8627,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;
 | 
			
		||||
@@ -8689,22 +8690,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);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user