mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Misc tidying up (zero-clear structures, more unused default in ClipRetFullscreen, NavApplyItemToResult() coding style fix)
Zero-clearing more structures Remove arbitrary default ClipRetFullscreen value in ImDrawListSharedData. Nav extracted NavApplyItemToResult() function. Coding style fixes in OSX Backends.
This commit is contained in:
		
							
								
								
									
										24
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -862,6 +862,7 @@ static float            NavUpdatePageUpPageDown(); | ||||
| static inline void      NavUpdateAnyRequestFlag(); | ||||
| static void             NavEndFrame(); | ||||
| static bool             NavScoreItem(ImGuiNavMoveResult* result, ImRect cand); | ||||
| static void             NavApplyItemToResult(ImGuiNavMoveResult* result, ImGuiWindow* window, ImGuiID id, const ImRect& nav_bb_rel); | ||||
| static void             NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, ImGuiID id); | ||||
| static ImVec2           NavCalcPreferredRefPos(); | ||||
| static void             NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window); | ||||
| @@ -8377,6 +8378,14 @@ static bool ImGui::NavScoreItem(ImGuiNavMoveResult* result, ImRect cand) | ||||
|     return new_best; | ||||
| } | ||||
|  | ||||
| static void ImGui::NavApplyItemToResult(ImGuiNavMoveResult* result, ImGuiWindow* window, ImGuiID id, const ImRect& nav_bb_rel) | ||||
| { | ||||
|     result->Window = window; | ||||
|     result->ID = id; | ||||
|     result->FocusScopeId = window->DC.NavFocusScopeIdCurrent; | ||||
|     result->RectRel = nav_bb_rel; | ||||
| } | ||||
|  | ||||
| // We get there when either NavId == id, or when g.NavAnyRequest is set (which is updated by NavUpdateAnyRequestFlag above) | ||||
| static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id) | ||||
| { | ||||
| @@ -8417,25 +8426,14 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con | ||||
|         bool new_best = g.NavMoveRequest && NavScoreItem(result, nav_bb); | ||||
| #endif | ||||
|         if (new_best) | ||||
|         { | ||||
|             result->Window = window; | ||||
|             result->ID = id; | ||||
|             result->FocusScopeId = window->DC.NavFocusScopeIdCurrent; | ||||
|             result->RectRel = nav_bb_rel; | ||||
|         } | ||||
|             NavApplyItemToResult(result, window, id, nav_bb_rel); | ||||
|  | ||||
|         // Features like PageUp/PageDown need to maintain a separate score for the visible set of items. | ||||
|         const float VISIBLE_RATIO = 0.70f; | ||||
|         if ((g.NavMoveRequestFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) | ||||
|             if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) | ||||
|                 if (NavScoreItem(&g.NavMoveResultLocalVisibleSet, nav_bb)) | ||||
|                 { | ||||
|                     result = &g.NavMoveResultLocalVisibleSet; | ||||
|                     result->Window = window; | ||||
|                     result->ID = id; | ||||
|                     result->FocusScopeId = window->DC.NavFocusScopeIdCurrent; | ||||
|                     result->RectRel = nav_bb_rel; | ||||
|                 } | ||||
|                     NavApplyItemToResult(&g.NavMoveResultLocalVisibleSet, window, id, nav_bb_rel); | ||||
|     } | ||||
|  | ||||
|     // Update window-relative bounding box of navigated item | ||||
|   | ||||
		Reference in New Issue
	
	Block a user