mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Allow adjusting height factor of text selection rectangle
Add `CTextCursor::m_SelectionHeightFactor` setting to adjust the height of the text selection rectangle. For example a value of `0.5f` means that the selection rectangle has half its normal height while still being aligned at the same bottom position.
This commit is contained in:
parent
facbcfc391
commit
ca90d83c10
|
@ -800,6 +800,7 @@ public:
|
|||
pCursor->m_LongestLineWidth = 0;
|
||||
|
||||
pCursor->m_CalculateSelectionMode = TEXT_CURSOR_SELECTION_MODE_NONE;
|
||||
pCursor->m_SelectionHeightFactor = 1.0f;
|
||||
pCursor->m_PressMouseX = 0;
|
||||
pCursor->m_PressMouseY = 0;
|
||||
pCursor->m_ReleaseMouseX = 0;
|
||||
|
@ -1409,7 +1410,7 @@ public:
|
|||
|
||||
if(SelectionStarted && IsRendered)
|
||||
{
|
||||
vSelectionQuads.emplace_back(SelX, DrawY, SelWidth, Size);
|
||||
vSelectionQuads.emplace_back(SelX, DrawY + (1.0f - pCursor->m_SelectionHeightFactor) * Size, SelWidth, pCursor->m_SelectionHeightFactor * Size);
|
||||
}
|
||||
|
||||
LastSelX = SelX;
|
||||
|
|
|
@ -183,6 +183,7 @@ public:
|
|||
float m_AlignedFontSize;
|
||||
|
||||
ETextCursorSelectionMode m_CalculateSelectionMode;
|
||||
float m_SelectionHeightFactor;
|
||||
|
||||
// these coordinates are repsected if selection mode is set to calculate @see ETextCursorSelectionMode
|
||||
int m_PressMouseX;
|
||||
|
|
Loading…
Reference in a new issue