浏览代码

fix editable ios bug when typing

/main
xingwei.zhu 5 年前
当前提交
81e6ad35
共有 1 个文件被更改,包括 23 次插入11 次删除
  1. 34
      Runtime/rendering/editable.cs

34
Runtime/rendering/editable.cs


get {
switch (Application.platform) {
case RuntimePlatform.IPhonePlayer:
return Rect.fromLTWH(0.0f, -EditableUtils._kCaretHeightOffset + 0.5f, this.cursorWidth,
return Rect.fromLTWH(0.0f, 0.0f, this.cursorWidth,
this.preferredLineHeight + 2.0f);
default:
return Rect.fromLTWH(0.0f, EditableUtils._kCaretHeightOffset, this.cursorWidth,

if (this._cursorOffset != null) {
caretRect = caretRect.shift(this._cursorOffset);
}
#if !UNITY_IOS
if (this._textPainter.getFullHeightForCaret(textPosition, this._caretPrototype) != null) {
caretRect = Rect.fromLTWH(
caretRect.left,
caretRect.top - EditableUtils._kCaretHeightOffset,
caretRect.width,
this._textPainter.getFullHeightForCaret(textPosition, this._caretPrototype).Value
);
float? caretHeight = this._textPainter.getFullHeightForCaret(textPosition, this._caretPrototype);
if (caretHeight != null) {
switch (Application.platform) {
case RuntimePlatform.IPhonePlayer:
float heightDiff = caretHeight.Value - caretRect.height;
caretRect = Rect.fromLTWH(
caretRect.left,
caretRect.top + heightDiff / 2f,
caretRect.width,
caretRect.height
);
break;
default:
caretRect = Rect.fromLTWH(
caretRect.left,
caretRect.top - EditableUtils._kCaretHeightOffset,
caretRect.width,
caretHeight.Value
);
break;
}
#endif
caretRect = caretRect.shift(this._getPixelPerfectCursorOffset(caretRect));

正在加载...
取消
保存