draw method

  1. @override
void draw(
  1. Canvas canvas,
  2. Size size
)
override

Draws the object on the provided canvas of size size.

Implementation

@override
void draw(Canvas canvas, Size size) {
  // Draw the assist lines
  drawAssists(canvas, size);

  // Save the canvas before transforming it, to be restored after the object is drawn
  canvas.save();

  // Translate and rotate the canvas according to the position of the object
  canvas.translate(position.dx, position.dy);
  canvas.rotate(rotationAngle);
  canvas.translate(-position.dx, -position.dy);

  // Draw the object
  drawObject(canvas, size);

  // Restore the canvas from the translation and rotation
  canvas.restore();
}