constImRect&curr=g.NavScoringRectScreen;// Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having lots of items with varied width)
constImRect&curr=g.NavScoringRectScreen;// Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having varied item width)
// We perform scoring on items bounding box clipped by their parent window on the other axis (clipping on our movement axis would give us equal scores for all clipped items)
floatdby=NavScoreItemDistInterval(ImLerp(cand.Min.y,cand.Max.y,0.2f),ImLerp(cand.Min.y,cand.Max.y,0.8f),ImLerp(curr.Min.y,curr.Max.y,0.2f),ImLerp(curr.Min.y,curr.Max.y,0.8f));// Scale down on Y to keep using box-distance for vertically touching items
// Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving "later" buttons
// Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving "later" items
// (with higher index) to the right/downwards by an infinitesimal amount since we the current "best" button already (so it must have a lower index),
// this is fairly easy. This rule ensures that all buttons with dx==dy==0 will end up being linked in order of appearance along the x axis.
if(((g.NavMoveDir==ImGuiDir_Up||g.NavMoveDir==ImGuiDir_Down)?dby:dbx)<0.0f)// moving bj to the right/down decreases distance