浏览代码

fix cursor

/main
fzhangtj 6 年前
当前提交
06b771d5
共有 2 个文件被更改,包括 14 次插入6 次删除
  1. 18
      Runtime/rendering/editable.cs
  2. 2
      Runtime/widgets/editable_text.cs

18
Runtime/rendering/editable.cs


using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public void handleTapDown(TapDownDetails details) {
this._lastTapDownPosition = details.globalPosition - this._paintOffset;
if (!Application.isMobilePlatform) {
this._selectForTap(this._lastTapDownPosition);
}
if (this.onSelectionChanged != null) {
var position = this._textPainter.getPositionForOffset(this.globalToLocal(this._lastTapDownPosition));
this.onSelectionChanged(TextSelection.fromPosition(position), this, SelectionChangedCause.tap);
if (Application.isMobilePlatform) {
this._selectForTap(this._lastTapDownPosition);
}
}

return new TextSelection(baseOffset: word.start, extentOffset: word.end);
}
void _selectForTap(Offset pointerPosition) {
if (this.onSelectionChanged != null) {
var position = this._textPainter.getPositionForOffset(this.globalToLocal(pointerPosition));
this.onSelectionChanged(TextSelection.fromPosition(position), this, SelectionChangedCause.tap);
}
}
bool _isMultiline {
get { return this._maxLines != 1; }
}

2
Runtime/widgets/editable_text.cs


this._hideSelectionOverlayIfNeeded();
if (this.widget.selectionControls != null && !this._unityKeyboard()) {
if (this.widget.selectionControls != null && Application.isMobilePlatform && !this._unityKeyboard()) {
this._selectionOverlay = new TextSelectionOverlay(
context: this.context,
value: this._value,

正在加载...
取消
保存