debugRender method

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

Renders the subtree under this node's transform, marking position with a 2-pixel cross before anything this node or its children draw.

The cross draws under every DebugMode, in that mode's own color, so a wireframe of one category still says where each node sits. DebugMode.spatial adds the bounds.

Overridden rather than drawn through debugDraw because the transform has to wrap the children too, and a callback would cost every node in the engine a list and a closure it may never use.

Implementation

@override
void debugRender(Canvas canvas) {
  canvas.save();
  canvas.transform(_renderTransform);

  final debug = Ignis.debug;
  final paint = debug.paint;
  final x = anchor.x * width;
  final y = anchor.y * height;

  canvas.drawLine(.new(x - 1, y), .new(x + 1, y), paint);
  canvas.drawLine(.new(x, y - 1), .new(x, y + 1), paint);

  if (debug.draws(.spatial)) {
    canvas.drawRect(shape.rect(), paint);
  }

  super.debugRender(canvas);
  canvas.restore();
}