erase()

in src/app/canvas.component.ts [119:134]


  erase() {
    if (!this.canvas()) return;
    const el = this.canvas()!.nativeElement as HTMLCanvasElement;
    const context = el.getContext('2d');

    if (!context) return;

    this.pointBuffer = [];

    context.reset();

    context.strokeStyle = '#000000';
    context.fillStyle = '#ffffff';
    context.fillRect(0, 0, this.width(), this.height());
    context.fill();
  }