mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fixed bug where auto-scrolling occasionally gets disabled
Issue happened when scrolling back, most of the time it will work, but there is always jitter in the first frame after the change which could result in ImGui::GetScrollY() <= ImGui::GetScrollMaxY() resulting in auto-scroll disable. Only scroll back if ImGui::GetScrollY() <= ImGui::GetScrollMaxY() and always reset value of CConsole::m_nScrollBack.
This commit is contained in:
parent
cdc32531eb
commit
d7a004a0eb
@ -214,11 +214,12 @@ void CConsole::BasePanel(void)
|
||||
m_bCopyToClipBoard = false;
|
||||
}
|
||||
|
||||
if (m_nScrollBack > 0)
|
||||
if (!m_Logger.m_bScrolledToMax && m_nScrollBack > 0)
|
||||
{
|
||||
ImGui::SetScrollY(ImGui::GetScrollY() - m_nScrollBack * fontSize.y);
|
||||
m_nScrollBack = 0;
|
||||
}
|
||||
m_nScrollBack = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
ImGui::EndChild();
|
||||
|
@ -205,6 +205,7 @@ private:
|
||||
public:
|
||||
bool m_bAutoScroll;
|
||||
bool m_bScrollToBottom;
|
||||
bool m_bScrolledToMax;
|
||||
private:
|
||||
bool m_bHandleKeyboardInputs;
|
||||
bool m_bHandleMouseInputs;
|
||||
|
4
r5dev/thirdparty/imgui/src/imgui_logger.cpp
vendored
4
r5dev/thirdparty/imgui/src/imgui_logger.cpp
vendored
@ -28,6 +28,7 @@ CTextLogger::CTextLogger()
|
||||
, m_bAutoScroll(true)
|
||||
, m_bScrollToBottom(true)
|
||||
, m_bScrollToCursor(false)
|
||||
, m_bScrolledToMax(false)
|
||||
, m_flTextStart(0.0f)
|
||||
, m_nLeftMargin(0)
|
||||
, m_bCursorPositionChanged(false)
|
||||
@ -860,8 +861,9 @@ void CTextLogger::Render()
|
||||
|
||||
|
||||
ImGui::Dummy(ImVec2((longest + 2), m_Lines.size() * m_CharAdvance.y));
|
||||
m_bScrolledToMax = ImGui::GetScrollY() >= ImGui::GetScrollMaxY();
|
||||
|
||||
if (m_bScrollToBottom || (!m_bScrollToCursor && m_bAutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()))
|
||||
if (m_bScrollToBottom || (!m_bScrollToCursor && m_bAutoScroll && m_bScrolledToMax))
|
||||
{
|
||||
ImGui::SetScrollHereY(1.0f);
|
||||
m_bScrollToBottom = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user