wordBoundaryAt method

  1. @override
(int, int) wordBoundaryAt(
  1. DiagramPoint point
)
override

Word containing the shaped glyph at a line-local point.

Implementation

@override
(int, int) wordBoundaryAt(DiagramPoint point) {
  if (emptyCaretX != null) return (0, 0);
  final glyph = _paragraph.getClosestGlyphForOffset(
    Offset(point.x, top + point.y),
  );
  if (glyph == null) return (0, 0);
  final range = _paragraph.getWordBoundary(
    TextPosition(offset: glyph.graphemeClusterCodeUnitRange.start),
  );
  return (range.start - start, range.end - start);
}