@ -594,6 +594,8 @@ 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# include  <stdint.h>     // intptr_t  
					 
					 
					 
					# include  <stdint.h>     // intptr_t  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# endif  
					 
					 
					 
					# endif  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					# define IMGUI_DEBUG_NAV 0  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# ifdef _MSC_VER  
					 
					 
					 
					# ifdef _MSC_VER  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma warning (disable: 4127)  // condition expression is constant
  
					 
					 
					 
					# pragma warning (disable: 4127)  // condition expression is constant
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma warning (disable: 4505)  // unreferenced local function has been removed (stb stuff)
  
					 
					 
					 
					# pragma warning (disable: 4505)  // unreferenced local function has been removed (stb stuff)
  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -2091,7 +2093,7 @@ static bool NavScoreItem(ImRect cand) 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        quadrant  =  ( window - > DC . LastItemId  <  g . NavId )  ?  ImGuiDir_Left  :  ImGuiDir_Right ;   
					 
					 
					 
					        quadrant  =  ( window - > DC . LastItemId  <  g . NavId )  ?  ImGuiDir_Left  :  ImGuiDir_Right ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					#if 0  // [DEBUG]
   
					 
					 
					 
					# if IMGUI_DEBUG_NAV  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( ImGui : : IsMouseHoveringRect ( cand . Min ,  cand . Max ) )   
					 
					 
					 
					    if  ( ImGui : : IsMouseHoveringRect ( cand . Min ,  cand . Max ) )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    {   
					 
					 
					 
					    {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        char  buf [ 128 ] ;   
					 
					 
					 
					        char  buf [ 128 ] ;   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -2184,7 +2186,7 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    //      So eventually we would like to provide the user will the primitives to be able to implement that customized/efficient navigation handling whenever necessary.
   
					 
					 
					 
					    //      So eventually we would like to provide the user will the primitives to be able to implement that customized/efficient navigation handling whenever necessary.
   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    const  ImGuiItemFlags  item_flags  =  window - > DC . ItemFlags ;   
					 
					 
					 
					    const  ImGuiItemFlags  item_flags  =  window - > DC . ItemFlags ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( id  ! =  NULL  & &  g . NavWindow  = =  window - > RootNavWindow )   
					 
					 
					 
					    if  ( id  ! =  NULL  & &  g . NavWindow  = =  window - > RootNavWindow )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        if  ( g . NavId  = =  * id  | |  g . NavMoveRequest  | |  g . NavInitDefaultRequest )   
					 
					 
					 
					        if  ( g . NavId  = =  * id  | |  g . NavMoveRequest  | |  g . NavInitDefaultRequest  | |  IMGUI_DEBUG_NAV  )   
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					            if  ( g . IO . NavUsable  & &  ! ( item_flags  &  ImGuiItemFlags_NoNav ) )   
					 
					 
					 
					            if  ( g . IO . NavUsable  & &  ! ( item_flags  &  ImGuiItemFlags_NoNav ) )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            {   
					 
					 
					 
					            {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                const  ImRect &  nav_bb  =  nav_bb_arg  ?  * nav_bb_arg  :  bb ;   
					 
					 
					 
					                const  ImRect &  nav_bb  =  nav_bb_arg  ?  * nav_bb_arg  :  bb ;   
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -2201,16 +2203,22 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    }   
					 
					 
					 
					                    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                }   
					 
					 
					 
					                }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                //const bool DEBUG_NAV = false; // [DEBUG] Enable to test scoring on all items.
   
					 
					 
					 
					                bool  new_best  =  false ;   
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					                if  ( ( g . NavMoveRequest  /*|| DEBUG_NAV*/ )  & &  g . NavId  ! =  * id )   
					 
					 
					 
					# if IMGUI_DEBUG_NAV  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					                {   
					 
					 
					 
					                // [DEBUG] Score items at all times
   
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					                    //if (DEBUG_NAV && !g.NavMoveRequest) g.NavMoveDir = ImGuiDir_N;
   
					 
					 
					 
					                if  ( ! g . NavMoveRequest )  
  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					                    if  ( NavScoreItem ( nav_bb ) )  //if (!DEBUG || g.NavMoveRequest)
   
					 
					 
					 
					                    g . NavMoveDir  =  g . NavMoveDirLast ;   
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					                if  ( g . NavId  ! =  * id )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					                    new_best  =  NavScoreItem ( nav_bb )  & &  g . NavMoveRequest ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					# else  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					                if  ( g . NavMoveRequest  & &  g . NavId  ! =  * id )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					                    new_best  =  NavScoreItem ( nav_bb ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					# endif  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					                if  ( new_best )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                {   
					 
					 
					 
					                {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    g . NavMoveResultId  =  * id ;   
					 
					 
					 
					                    g . NavMoveResultId  =  * id ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    g . NavMoveResultRectRel  =  nav_bb_rel ;   
					 
					 
					 
					                    g . NavMoveResultRectRel  =  nav_bb_rel ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                }   
					 
					 
					 
					                }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                // Update window-relative bounding box of navigated item
   
					 
					 
					 
					                // Update window-relative bounding box of navigated item
   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                if  ( g . NavId  = =  * id )   
					 
					 
					 
					                if  ( g . NavId  = =  * id )   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -2778,7 +2786,10 @@ static void NavUpdate() 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        if  ( ( allowed_dir_flags  &  ( 1 < < ImGuiDir_Down ) )   & &  IsNavInputPressed ( ImGuiNavInput_PadDown ,   ImGuiNavReadMode_Repeat ) )  g . NavMoveDir  =  ImGuiDir_Down ;   
					 
					 
					 
					        if  ( ( allowed_dir_flags  &  ( 1 < < ImGuiDir_Down ) )   & &  IsNavInputPressed ( ImGuiNavInput_PadDown ,   ImGuiNavReadMode_Repeat ) )  g . NavMoveDir  =  ImGuiDir_Down ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( g . NavMoveDir  ! =  ImGuiDir_None )   
					 
					 
					 
					    if  ( g . NavMoveDir  ! =  ImGuiDir_None )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        g . NavMoveRequest  =  true ;   
					 
					 
					 
					        g . NavMoveRequest  =  true ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        g . NavMoveDirLast  =  g . NavMoveDir ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    // If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
   
					 
					 
					 
					    // If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( g . NavMoveRequest  & &  g . NavId  = =  0 )   
					 
					 
					 
					    if  ( g . NavMoveRequest  & &  g . NavId  = =  0 )