pointerDown method

bool pointerDown(
  1. TextSelectionTarget target,
  2. Vec2D point, {
  3. int pointerId = 0,
  4. bool extend = false,
})

Implementation

bool pointerDown(
  TextSelectionTarget target,
  Vec2D point, {
  int pointerId = 0,
  bool extend = false,
}) {
  if (isDragging) return false;
  final hit = target.selectionHit(point);
  final index = _targets.indexOf(target);
  if (hit == null || index < 0) return false;
  final endpoint = (index, hit.offset);
  if (!extend || !validate()) {
    clear();
    _anchor = endpoint;
    _sources = _targets.map((t) => t.selectionText).toList();
  }
  _extent = endpoint;
  _pointer = pointerId;
  _apply();
  return true;
}