Scrolling: Exposed SetNextWindowScroll() in public API. (#1526)

This commit is contained in:
ocornut
2022-11-09 17:03:07 +01:00
parent cda26635cd
commit 7380b9816e
4 changed files with 10 additions and 2 deletions

View File

@ -6721,6 +6721,8 @@ struct ExampleAppConsole
if (copy_to_clipboard)
ImGui::LogFinish();
// Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame.
// Using a scrollbar or mouse-wheel will take away from the bottom edge.
if (ScrollToBottom || (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()))
ImGui::SetScrollHereY(1.0f);
ScrollToBottom = false;
@ -7029,6 +7031,8 @@ struct ExampleAppLog
}
ImGui::PopStyleVar();
// Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame.
// Using a scrollbar or mouse-wheel will take away from the bottom edge.
if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
ImGui::SetScrollHereY(1.0f);
}