mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix multi-line text selection not rendered correctly anymore
The `CTextCursor::m_LineCount` variable is only updated after the cursor is rendered. For calculating the selection quads we need to check `LineCount` instead, which is updated while the cursor is being rendered. Regression from #7733.
This commit is contained in:
parent
84cbd362e8
commit
a873485643
|
@ -1867,7 +1867,7 @@ public:
|
||||||
|
|
||||||
if(SelectionStarted && IsRendered)
|
if(SelectionStarted && IsRendered)
|
||||||
{
|
{
|
||||||
if(!vSelectionQuads.empty() && SelectionQuadLine == pCursor->m_LineCount)
|
if(!vSelectionQuads.empty() && SelectionQuadLine == LineCount)
|
||||||
{
|
{
|
||||||
vSelectionQuads.back().m_Width += SelWidth;
|
vSelectionQuads.back().m_Width += SelWidth;
|
||||||
}
|
}
|
||||||
|
@ -1877,7 +1877,7 @@ public:
|
||||||
const float SelectionY = DrawY + (1.0f - pCursor->m_SelectionHeightFactor) * SelectionHeight;
|
const float SelectionY = DrawY + (1.0f - pCursor->m_SelectionHeightFactor) * SelectionHeight;
|
||||||
const float ScaledSelectionHeight = pCursor->m_SelectionHeightFactor * SelectionHeight;
|
const float ScaledSelectionHeight = pCursor->m_SelectionHeightFactor * SelectionHeight;
|
||||||
vSelectionQuads.emplace_back(SelX, SelectionY, SelWidth, ScaledSelectionHeight);
|
vSelectionQuads.emplace_back(SelX, SelectionY, SelWidth, ScaledSelectionHeight);
|
||||||
SelectionQuadLine = pCursor->m_LineCount;
|
SelectionQuadLine = LineCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue