@@ -1320,7 +1320,7 @@ Rect _getCaretPrototype {
1320
1320
get {
1321
1321
switch ( Application . platform ) {
1322
1322
case RuntimePlatform . IPhonePlayer :
1323
- return Rect . fromLTWH ( 0.0f , - EditableUtils . _kCaretHeightOffset + 0.5f , this . cursorWidth ,
1323
+ return Rect . fromLTWH ( 0.0f , 0.0f , this . cursorWidth ,
1324
1324
this . preferredLineHeight + 2.0f ) ;
1325
1325
default :
1326
1326
return Rect . fromLTWH ( 0.0f , EditableUtils . _kCaretHeightOffset , this . cursorWidth ,
@@ -1363,17 +1363,29 @@ void _paintCaret(Canvas canvas, Offset effectiveOffset, TextPosition textPositio
1363
1363
if ( this . _cursorOffset != null ) {
1364
1364
caretRect = caretRect . shift ( this . _cursorOffset ) ;
1365
1365
}
1366
-
1367
- #if ! UNITY_IOS
1368
- if ( this . _textPainter . getFullHeightForCaret ( textPosition , this . _caretPrototype ) != null ) {
1369
- caretRect = Rect . fromLTWH (
1370
- caretRect . left ,
1371
- caretRect . top - EditableUtils . _kCaretHeightOffset ,
1372
- caretRect . width ,
1373
- this . _textPainter . getFullHeightForCaret ( textPosition , this . _caretPrototype ) . Value
1374
- ) ;
1366
+
1367
+ float ? caretHeight = this . _textPainter . getFullHeightForCaret ( textPosition , this . _caretPrototype ) ;
1368
+ if ( caretHeight != null ) {
1369
+ switch ( Application . platform ) {
1370
+ case RuntimePlatform . IPhonePlayer :
1371
+ float heightDiff = caretHeight . Value - caretRect . height ;
1372
+ caretRect = Rect . fromLTWH (
1373
+ caretRect . left ,
1374
+ caretRect . top + heightDiff / 2f ,
1375
+ caretRect . width ,
1376
+ caretRect . height
1377
+ ) ;
1378
+ break ;
1379
+ default :
1380
+ caretRect = Rect . fromLTWH (
1381
+ caretRect . left ,
1382
+ caretRect . top - EditableUtils . _kCaretHeightOffset ,
1383
+ caretRect . width ,
1384
+ caretHeight . Value
1385
+ ) ;
1386
+ break ;
1387
+ }
1375
1388
}
1376
- #endif
1377
1389
1378
1390
caretRect = caretRect . shift ( this . _getPixelPerfectCursorOffset ( caretRect ) ) ;
1379
1391
0 commit comments