|
|
|
|
|
|
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; } |
|
|
|
} |
|
|
|