Skip to content

Commit

Permalink
ScrollToRectEx: Fix bug where scrolling horizontally to an always-cen…
Browse files Browse the repository at this point in the history
…tered element that is not visible but could be would take the item's Y coordinate into account.

Neither behavior were used in the codebase for this axis.
Amend 27c58c3 (#5902, #2812, #4242, #2900)
Signed-off-by: Neil Bickford <nbickford@nvidia.com>
  • Loading branch information
NBickford-NV authored and ocornut committed Dec 20, 2022
1 parent 91b356c commit f1ddf63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9666,7 +9666,7 @@ ImVec2 ImGui::ScrollToRectEx(ImGuiWindow* window, const ImRect& item_rect, ImGui
else if (((flags & ImGuiScrollFlags_KeepVisibleCenterX) && !fully_visible_x) || (flags & ImGuiScrollFlags_AlwaysCenterX))
{
if (can_be_fully_visible_x)
SetScrollFromPosX(window, ImFloor((item_rect.Min.x + item_rect.Max.y) * 0.5f) - window->Pos.x, 0.5f);
SetScrollFromPosX(window, ImFloor((item_rect.Min.x + item_rect.Max.x) * 0.5f) - window->Pos.x, 0.5f);
else
SetScrollFromPosX(window, item_rect.Min.x - window->Pos.x, 0.0f);
}
Expand Down

0 comments on commit f1ddf63

Please sign in to comment.