setSize method

void setSize(
  1. Size size
)

Sets the canvas size and updates dependent values.

Implementation

void setSize(Size size) {
  width = size.width;
  height = size.height;
  sizeMin = min(width, height);
  center = Offset(width / 2, height / 2);
  spawnArea = Rect.fromLTRB(
    center.dx - sizeMin / 100,
    center.dy - sizeMin / 100,
    center.dx + sizeMin / 100,
    center.dy + sizeMin / 100,
  );
  init();
}