pointsToStrokes method

List<List<Point>> pointsToStrokes(
  1. double minDistanceBetweenPoints
)
inherited

Helper method to convert points to strokes

Implementation

List<List<Point>> pointsToStrokes(double minDistanceBetweenPoints) {
  final List<List<Point>> strokes = <List<Point>>[];
  List<Point> currentStroke = <Point>[];
  for (final Point point in _optimizePoints(points, minDistance: minDistanceBetweenPoints)) {
    if (point.type == PointType.move) {
      currentStroke.add(point);
    } else {
      if (currentStroke.isNotEmpty) {
        strokes.add(currentStroke);
        currentStroke = <Point>[];
      }
      currentStroke.add(point);
    }
  }
  if (currentStroke.isNotEmpty) {
    strokes.add(currentStroke);
  }
  return strokes;
}