mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
ImGui: fix cursor scrolling bug
* Fix bug where moving cursor all the way to the top + little bit, and then moving below will also scroll the text position below (cursor sticked to top rect). * Fix bug where cursor skipped a column when moving it past the right perimeter of the console.
This commit is contained in:
parent
3273b7112c
commit
bd797a92db
6
r5dev/thirdparty/imgui/misc/imgui_logger.cpp
vendored
6
r5dev/thirdparty/imgui/misc/imgui_logger.cpp
vendored
@ -1501,7 +1501,7 @@ void CTextLogger::EnsureCursorVisible()
|
||||
float width = ImGui::GetWindowWidth();
|
||||
float height = ImGui::GetWindowHeight();
|
||||
|
||||
float top = 1.0f + ImCeil(scrollY / m_CharAdvance.y);
|
||||
float top = ImCeil(scrollY / m_CharAdvance.y);
|
||||
float bottom = ImCeil((scrollY + height) / m_CharAdvance.y);
|
||||
|
||||
float left = ImCeil(scrollX / m_CharAdvance.x);
|
||||
@ -1510,10 +1510,10 @@ void CTextLogger::EnsureCursorVisible()
|
||||
if (pos.m_nColumn < left)
|
||||
ImGui::SetScrollX(ImMax(0.0f, (pos.m_nColumn) * m_CharAdvance.x));
|
||||
if (pos.m_nColumn > right - 3)
|
||||
ImGui::SetScrollX(ImMax(0.0f, (pos.m_nColumn + 3) * m_CharAdvance.x - width));
|
||||
ImGui::SetScrollX(ImMax(0.0f, (pos.m_nColumn + 2) * m_CharAdvance.x - width));
|
||||
if (pos.m_nLine < top)
|
||||
ImGui::SetScrollY(ImMax(0.0f, (pos.m_nLine) * m_CharAdvance.y));
|
||||
if (pos.m_nLine > bottom - 2)
|
||||
if (pos.m_nLine > bottom - 3)
|
||||
ImGui::SetScrollY(ImMax(0.0f, (pos.m_nLine + 2) * m_CharAdvance.y - height));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user