mirror of
https://github.com/Drezil/imgui.git
synced 2025-04-01 17:02:45 +00:00
SetScrollHere() tweak to make the code a little less confusing
This commit is contained in:
parent
e36b41cbd0
commit
d43c25d8f4
@ -5310,8 +5310,9 @@ void ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio)
|
|||||||
void ImGui::SetScrollHere(float center_y_ratio)
|
void ImGui::SetScrollHere(float center_y_ratio)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
float target_y = window->DC.CursorPosPrevLine.y + (window->DC.PrevLineHeight * center_y_ratio) + (GImGui->Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line.
|
float target_y = window->DC.CursorPosPrevLine.y - window->Pos.y; // Top of last item, in window space
|
||||||
SetScrollFromPosY(target_y - window->Pos.y, center_y_ratio);
|
target_y += (window->DC.PrevLineHeight * center_y_ratio) + (GImGui->Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line.
|
||||||
|
SetScrollFromPosY(target_y, center_y_ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetKeyboardFocusHere(int offset)
|
void ImGui::SetKeyboardFocusHere(int offset)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user