rectsForRange method
List<Rect>
rectsForRange(
- int start,
- int end, {
- UDocTextGeometry geometry = UDocTextGeometry.auto,
Implementation
List<Rect> rectsForRange(int start, int end, {UDocTextGeometry geometry = UDocTextGeometry.auto}) {
final List<Rect> rects = <Rect>[];
int cursor = 0;
for (final UDocTextRun run in runs) {
final int runEnd = cursor + run.text.length;
if (runEnd > start && cursor < end) {
final int localStart = start > cursor ? start - cursor : 0;
final int localEnd = end < runEnd ? end - cursor : run.text.length;
rects.addAll(run.rectsFor(localStart, localEnd, geometry: geometry));
}
cursor = runEnd + 1;
}
return rects;
}