resize method

void resize(
  1. Offset tl,
  2. Offset br
)

Resize this inner rect

Implementation

void resize(Offset tl, Offset br) {
  double top = tl.dy;
  double left = tl.dx;
  double bottom = br.dy;
  double right = br.dx;

  if (br.dy < top) {
    final double temp = top;
    top = br.dy;
    bottom = temp;
  }

  if (br.dx < left) {
    final double temp = left;
    left = br.dx;
    right = temp;
  }

  /*
  * stkWidCenter ensure that the _boundingRect will not exceed the image bound
  * during onPaint() due to stroke width.
  */

  final double stkWidCenter = innerRectStrokeWidth / 2;
  left = max(left, stkWidCenter);
  top = max(top, stkWidCenter);
  right = min(right, imageWidth - stkWidCenter);
  bottom = min(bottom, imageHeight - stkWidCenter);

  region = Region(
      x1: left.toInt(),
      y1: top.toInt(),
      x2: right.toInt(),
      y2: bottom.toInt());
}