Use character midpoint calculation to increase cursor placement accuracy in text fields
This commit is contained in:
@@ -1280,9 +1280,12 @@ int CGraphicTextInstance::PixelPositionToCharacterPosition(int iPixelPosition)
|
||||
if (adv <= 0)
|
||||
adv = pCurCharInfo->width;
|
||||
|
||||
int charStart = icurPosition;
|
||||
icurPosition += adv;
|
||||
|
||||
if (adjustedPixelPos < icurPosition)
|
||||
int charMid = charStart + adv / 2;
|
||||
|
||||
if (adjustedPixelPos < charMid)
|
||||
{
|
||||
visualPos = i;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user