calculateBoundingBox method

void calculateBoundingBox()

Implementation

void calculateBoundingBox() {
  Rect bb = this.pathSegments.first.path.getBounds();
  double strokeWidth = 5;

  this.pathSegments.forEach((e) {
    bb = bb.expandToInclude(e.path.getBounds());
    if (strokeWidth < e.strokeWidth) {
      strokeWidth = e.strokeWidth;
    }
  });

  if (this.paints.isNotEmpty) {
    paints.forEach((e) {
      if (strokeWidth < e.strokeWidth) {
        strokeWidth = e.strokeWidth;
      }
    });
  }
  this.pathBoundingBox = bb.inflate(strokeWidth / 2);
  this.strokeWidth = strokeWidth;
}