ImGui: initialize newly added member vars and fix scrolling regression

The types should be floats instead of ints, the compiler actually compiled it as ints after changing to ImCeil. Made vars of correct type and removed extraneous casts.
This commit is contained in:
Kawe Mazidjatari 2024-02-29 01:32:45 +01:00
parent f9ed276cbd
commit 0c46b15139

View File

@ -23,6 +23,8 @@ static bool equals(InputIt1 first1, InputIt1 last1,
CTextLogger::CTextLogger()
: m_bAutoScroll(true)
, m_bScrollToCursor(false)
, m_bScrollToStart(false)
, m_bScrolledToStart(false)
, m_bScrollToBottom(true)
, m_bScrolledToBottom(false)
, m_bHandleUserInputs(true)
@ -1533,11 +1535,11 @@ void CTextLogger::EnsureCursorVisible()
float width = ImGui::GetWindowWidth();
float height = ImGui::GetWindowHeight();
int top = 1 + static_cast<int>(ImCeil(scrollY / m_CharAdvance.y));
int bottom = static_cast<int>(ImCeil((scrollY + height) / m_CharAdvance.y));
float top = 1.0f + ImCeil(scrollY / m_CharAdvance.y);
float bottom = ImCeil((scrollY + height) / m_CharAdvance.y);
int left = static_cast<int>(ImCeil(scrollX / m_CharAdvance.x));
int right = static_cast<int>(ImCeil((scrollX + width) / m_CharAdvance.x));
float left = ImCeil(scrollX / m_CharAdvance.x);
float right = ImCeil((scrollX + width) / m_CharAdvance.x);
if (pos.m_nColumn < left)
ImGui::SetScrollX(ImMax(0.0f, (pos.m_nColumn) * m_CharAdvance.x));