toBoundingBox method

Rect toBoundingBox()

Implementation

Rect toBoundingBox() {
  final xs = [topLeft.dx, topRight.dx, bottomRight.dx, bottomLeft.dx];
  final ys = [topLeft.dy, topRight.dy, bottomRight.dy, bottomLeft.dy];
  final minX = xs.reduce(math.min);
  final maxX = xs.reduce(math.max);
  final minY = ys.reduce(math.min);
  final maxY = ys.reduce(math.max);
  return Rect.fromLTRB(minX, minY, maxX, maxY);
}