Skip to content

Commit

Permalink
Merge pull request ddnet#9543 from Robyt3/Client-Touch-Console-Scroll…
Browse files Browse the repository at this point in the history
…-Fix

Fix console scrolling with touch input being too slow
  • Loading branch information
def- authored Jan 16, 2025
2 parents 6d89940 + 4845fc8 commit 2b1cc28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game/client/components/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,20 +1131,20 @@ void CGameConsole::OnRender()
{
pConsole->m_MouseRelease = GetMousePosition();
}
const float ScaledRowHeight = RowHeight / ScreenSize.y;
if(absolute(m_TouchState.m_ScrollAmount.y) >= ScaledRowHeight)
const float ScaledLineHeight = LineHeight / ScreenSize.y;
if(absolute(m_TouchState.m_ScrollAmount.y) >= ScaledLineHeight)
{
if(m_TouchState.m_ScrollAmount.y > 0.0f)
{
pConsole->m_BacklogCurLine += pConsole->GetLinesToScroll(-1, 1);
m_TouchState.m_ScrollAmount.y -= ScaledRowHeight;
m_TouchState.m_ScrollAmount.y -= ScaledLineHeight;
}
else
{
--pConsole->m_BacklogCurLine;
if(pConsole->m_BacklogCurLine < 0)
pConsole->m_BacklogCurLine = 0;
m_TouchState.m_ScrollAmount.y += ScaledRowHeight;
m_TouchState.m_ScrollAmount.y += ScaledLineHeight;
}
pConsole->m_HasSelection = false;
}
Expand Down

0 comments on commit 2b1cc28

Please sign in to comment.