@ -2198,14 +2198,25 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
}
}
# if IMGUI_DEBUG_NAV_SCORING
# if IMGUI_DEBUG_NAV_SCORING
char buf [ 128 ] ;
if ( ImGui : : IsMouseHoveringRect ( cand . Min , cand . Max ) )
if ( ImGui : : IsMouseHoveringRect ( cand . Min , cand . Max ) )
{
{
char buf [ 128 ] ;
ImFormatString ( buf , IM_ARRAYSIZE ( buf ) , " dbox (%.2f,%.2f->%.4f) \n dcen (%.2f,%.2f->%.4f) \n d (%.2f,%.2f->%.4f) \n nav %c, quadrant %c " , dbx , dby , dist_box , dcx , dcy , dist_center , dax , day , dist_axial , " WENS " [ g . NavMoveDir ] , " WENS " [ quadrant ] ) ;
ImFormatString( buf , IM_ARRAYSIZE ( buf ) , " dbox (%.2f,%.2f->%.4f) dcen (%.2f,%.2f->%.4f) d (%.2f,%.2f->%.4f) nav %c, quad %c " , dbx , dby , dist_box , dcx , dcy , dist_center , dax , day , dist_axial , " WENS " [ g . NavMoveDir ] , " WENS " [ quadrant ] ) ;
g. OverlayDrawList . AddRect ( curr . Min , curr . Max , IM_COL32 ( 255 , 200 , 0 , 100 ) ) ;
g . OverlayDrawList . AddRect ( cand . Min , cand . Max , IM_COL32 ( 255 , 255 , 0 , 200 ) ) ;
g . OverlayDrawList . AddRect ( cand . Min , cand . Max , IM_COL32 ( 255 , 255 , 0 , 200 ) ) ;
g . OverlayDrawList . AddRectFilled ( cand . Max - ImVec2 ( 4 , 4 ) , cand . Max + ImGui : : CalcTextSize ( buf ) + ImVec2 ( 4 , 4 ) , IM_COL32 ( 40 , 0 , 0 , 150 ) ) ;
g . OverlayDrawList . AddRectFilled ( cand . Max - ImVec2 ( 4 , 4 ) , cand . Max + ImGui : : CalcTextSize ( buf ) + ImVec2 ( 4 , 4 ) , IM_COL32 ( 40 , 0 , 0 , 150 ) ) ;
g . OverlayDrawList . AddText ( g . IO . FontDefault , 13.0f , cand . Max , ~ 0U , buf ) ;
g . OverlayDrawList . 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 ( 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 ) ;
g . OverlayDrawList . AddRectFilled ( cand . Min , cand . Max , IM_COL32 ( 255 , 0 , 0 , 200 ) ) ;
g . OverlayDrawList . AddText ( g . IO . FontDefault , 13.0f , cand . Min , IM_COL32 ( 255 , 255 , 255 , 255 ) , buf ) ;
}
}
# endif
# endif
// Is it in the quadrant we're interesting in moving to?
// Is it in the quadrant we're interesting in moving to?