import { Component, ViewChild } from '@angular/core';
import { SignaturePad } from 'angular-signature-pad-v2';

@Component({
  selector: 'app-signature-pad',
  standalone: false,
  templateUrl: './signature-pad.component.html',
  styleUrl: './signature-pad.component.css'
})
export class SignaturePadComponent {
  @ViewChild(SignaturePad) signaturePad!: SignaturePad;
  
  signaturePadOptions: Object = {
    'minWidth': 1,
    'maxWidth': 2,
    'canvasHeight': 254,
    'canvasWidth': 526,
    'velocityFilterWeigth': 0.7,
    'backgroundColor': "rgb(255,255,255)"
  };

  constructor() {}

  ngAfterViewInit(){
    if(this.signaturePad != undefined){
      this.signaturePad.set('minWidth', 5);
      this.signaturePad.clear();
    }
  }

  drawComplete() {
    console.log(this.signaturePad.toDataURL());
  }

  drawStart() {
    console.log("TEST");
  }
}
