@ -2545,36 +2545,37 @@ static void NavUpdate()
if ( g . NavMoveRequest & & g . NavMoveResultId ! = 0 )
{
IM_ASSERT ( g . NavWindow ) ;
ImGuiWindow * window = g . NavWindow ;
// Scroll to keep newly navigated item fully into view
ImRect window_rect_rel ( g . NavW indow- > InnerRect . Min - g . NavW indow- > Pos - ImVec2 ( 1 , 1 ) , g . NavW indow- > InnerRect . Max - g . NavW indow- > Pos + ImVec2 ( 1 , 1 ) ) ;
//g.OverlayDrawList.AddRect(g.NavWindow->Pos + window_rect_rel.Min, g.NavW indow->Pos + window_rect_rel.Max, IM_COL32_WHITE); // [DEBUG]
ImRect window_rect_rel ( w indow- > InnerRect . Min - w indow- > Pos - ImVec2 ( 1 , 1 ) , w indow- > InnerRect . Max - w indow- > Pos + ImVec2 ( 1 , 1 ) ) ;
//g.OverlayDrawList.AddRect(window->Pos + window_rect_rel.Min, w indow->Pos + window_rect_rel.Max, IM_COL32_WHITE); // [DEBUG]
if ( g . NavLayer = = 0 & & ! window_rect_rel . Contains ( g . NavMoveResultRectRel ) )
{
if ( g . NavW indow- > ScrollbarX & & g . NavMoveResultRectRel . Min . x < window_rect_rel . Min . x )
if ( w indow- > ScrollbarX & & g . NavMoveResultRectRel . Min . x < window_rect_rel . Min . x )
{
g . NavW indow- > ScrollTarget . x = g . NavMoveResultRectRel . Min . x + g . NavW indow- > Scroll . x - g . Style . ItemSpacing . x ;
g . NavW indow- > ScrollTargetCenterRatio . x = 0.0f ;
w indow- > ScrollTarget . x = g . NavMoveResultRectRel . Min . x + w indow- > Scroll . x - g . Style . ItemSpacing . x ;
w indow- > ScrollTargetCenterRatio . x = 0.0f ;
}
else if ( g . NavW indow- > ScrollbarX & & g . NavMoveResultRectRel . Max . x > = window_rect_rel . Max . x )
else if ( w indow- > ScrollbarX & & g . NavMoveResultRectRel . Max . x > = window_rect_rel . Max . x )
{
g . NavW indow- > ScrollTarget . x = g . NavMoveResultRectRel . Max . x + g . NavW indow- > Scroll . x + g . Style . ItemSpacing . x ;
g . NavW indow- > ScrollTargetCenterRatio . x = 1.0f ;
w indow- > ScrollTarget . x = g . NavMoveResultRectRel . Max . x + w indow- > Scroll . x + g . Style . ItemSpacing . x ;
w indow- > ScrollTargetCenterRatio . x = 1.0f ;
}
if ( g . NavMoveResultRectRel . Min . y < window_rect_rel . Min . y )
{
g . NavW indow- > ScrollTarget . y = g . NavMoveResultRectRel . Min . y + g . NavW indow- > Scroll . y - g . Style . ItemSpacing . y ;
g . NavW indow- > ScrollTargetCenterRatio . y = 0.0f ;
w indow- > ScrollTarget . y = g . NavMoveResultRectRel . Min . y + w indow- > Scroll . y - g . Style . ItemSpacing . y ;
w indow- > ScrollTargetCenterRatio . y = 0.0f ;
}
else if ( g . NavMoveResultRectRel . Max . y > = window_rect_rel . Max . y )
{
g . NavW indow- > ScrollTarget . y = g . NavMoveResultRectRel . Max . y + g . NavW indow- > Scroll . y + g . Style . ItemSpacing . y ;
g . NavW indow- > ScrollTargetCenterRatio . y = 1.0f ;
w indow- > ScrollTarget . y = g . NavMoveResultRectRel . Max . y + w indow- > Scroll . y + g . Style . ItemSpacing . y ;
w indow- > ScrollTargetCenterRatio . y = 1.0f ;
}
// Estimate upcoming scroll so we can offset our relative mouse position so mouse position can be applied immediately (under this block)
ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp ( g . NavW indow) ;
g . NavMoveResultRectRel . Translate ( g . NavW indow- > Scroll - next_scroll ) ;
ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp ( w indow) ;
g . NavMoveResultRectRel . Translate ( w indow- > Scroll - next_scroll ) ;
}
// Apply result from previous frame navigation directional move request