mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-17 04:00:42 +00:00
Refactoring: refacroting of the method charPositionOfString:(CPString)aString withFont:(CPFont)aFont forPoint:(CGPoint)aPoint refs#78e29d2bbfe43f5a8bda2e65d974f7effb8fcbd4
This commit is contained in:
1 parent
78e29d2bbf
commit
e214bf3581
1 file changed
+3
-11
@@ -144,21 +144,13 @@ var DOMFixedWidthSpanElement = nil,
|
||||
|
||||
currentString += char;
|
||||
|
||||
var sizeOfString = [self sizeOfString:currentString withFont:aFont forWidth:nil].width;
|
||||
var sizeOfString = [self sizeOfString:currentString withFont:aFont forWidth:nil].width,
|
||||
sizeLastChar = [self sizeOfString:char withFont:aFont forWidth:nil].width;
|
||||
|
||||
if (sizeOfString < aPoint.x)
|
||||
{
|
||||
if (sizeOfString - sizeLastChar / 2 < aPoint.x)
|
||||
position++;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sizeLastChar = [self sizeOfString:char withFont:aFont forWidth:nil].width;
|
||||
|
||||
if (sizeOfString - sizeLastChar / 2 < aPoint.x)
|
||||
position++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return position;
|
||||
|
||||
Reference in new issue
Block a user