mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-06 03:25:36 +00:00
FullscreenUI: Fix nav wrapping if first item is disabled
This commit is contained in:
parent
6f2225fb61
commit
003518c234
@ -10957,7 +10957,7 @@ void ImGui::SetScrollY(float scroll_y)
|
|||||||
void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio)
|
void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio)
|
||||||
{
|
{
|
||||||
IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f);
|
IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f);
|
||||||
window->ScrollTarget.x = IM_TRUNC(local_x - window->DecoOuterSizeX1 - window->DecoInnerSizeX1 + window->Scroll.x); // Convert local position to scroll offset
|
window->ScrollTarget.x = IM_TRUNC(local_x - window->DecoOuterSizeX1 - window->DecoInnerSizeX1 + window->ScrollExpected.x); // Convert local position to scroll offset
|
||||||
window->ScrollTargetCenterRatio.x = center_x_ratio;
|
window->ScrollTargetCenterRatio.x = center_x_ratio;
|
||||||
window->ScrollTargetEdgeSnapDist.x = 0.0f;
|
window->ScrollTargetEdgeSnapDist.x = 0.0f;
|
||||||
}
|
}
|
||||||
@ -10965,7 +10965,7 @@ void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x
|
|||||||
void ImGui::SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio)
|
void ImGui::SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio)
|
||||||
{
|
{
|
||||||
IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
|
IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
|
||||||
window->ScrollTarget.y = IM_TRUNC(local_y - window->DecoOuterSizeY1 - window->DecoInnerSizeY1 + window->Scroll.y); // Convert local position to scroll offset
|
window->ScrollTarget.y = IM_TRUNC(local_y - window->DecoOuterSizeY1 - window->DecoInnerSizeY1 + window->ScrollExpected.y); // Convert local position to scroll offset
|
||||||
window->ScrollTargetCenterRatio.y = center_y_ratio;
|
window->ScrollTargetCenterRatio.y = center_y_ratio;
|
||||||
window->ScrollTargetEdgeSnapDist.y = 0.0f;
|
window->ScrollTargetEdgeSnapDist.y = 0.0f;
|
||||||
}
|
}
|
||||||
@ -12959,6 +12959,7 @@ static void ImGui::NavUpdateCreateWrappingRequest()
|
|||||||
bb_rel.TranslateX(-bb_rel.GetWidth()); // Previous column
|
bb_rel.TranslateX(-bb_rel.GetWidth()); // Previous column
|
||||||
clip_dir = ImGuiDir_Left;
|
clip_dir = ImGuiDir_Left;
|
||||||
}
|
}
|
||||||
|
SetScrollY(window, window->ScrollMax.y);
|
||||||
do_forward = true;
|
do_forward = true;
|
||||||
}
|
}
|
||||||
if (g.NavMoveDir == ImGuiDir_Down && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY)))
|
if (g.NavMoveDir == ImGuiDir_Down && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY)))
|
||||||
@ -12969,6 +12970,7 @@ static void ImGui::NavUpdateCreateWrappingRequest()
|
|||||||
bb_rel.TranslateX(+bb_rel.GetWidth()); // Next column
|
bb_rel.TranslateX(+bb_rel.GetWidth()); // Next column
|
||||||
clip_dir = ImGuiDir_Right;
|
clip_dir = ImGuiDir_Right;
|
||||||
}
|
}
|
||||||
|
SetScrollY(window, 0.0f);
|
||||||
do_forward = true;
|
do_forward = true;
|
||||||
}
|
}
|
||||||
if (!do_forward)
|
if (!do_forward)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user