drawSegment method

  1. @override
void drawSegment(
  1. Vector2 p1,
  2. Vector2 p2,
  3. Color3i color
)
override

Draw a line segment. WARNING: This mutates p1 and p2.

Implementation

@override
void drawSegment(Vector2 p1, Vector2 p2, Color3i color) {
  _setColor(color);
  final screenP1 = worldToScreen(p1);
  final screenP2 = worldToScreen(p2);

  ctx.beginPath();
  ctx.moveTo(screenP1.x, screenP1.y);
  ctx.lineTo(screenP2.x, screenP2.y);
  ctx.closePath();
  ctx.stroke();
}