renderTree method

  1. @override
void renderTree(
  1. Canvas canvas
)
override

Implementation

@override
void renderTree(Canvas canvas) {
  canvas.save();

  if (isFlipHorizontal || isFlipVertical || angle != 0) {
    canvas.translate(this.center.x, this.center.y);
    if (angle != 0) {
      canvas.rotate(angle);
    }
    if (isFlipHorizontal || isFlipVertical) {
      canvas.scale(isFlipHorizontal ? -1 : 1, isFlipVertical ? -1 : 1);
    }

    canvas.translate(-this.center.x, -this.center.y);
  }

  render(canvas);

  canvas.restore();

  children.forEach((c) => c.renderTree(canvas));

  // Any debug rendering should be rendered on top of everything
  if (debugMode) {
    renderDebugMode(canvas);
  }
}