0

I am using angular2-signaturepad to collect digital signatures in an angular 6 application. Some users are just drawing a simple dot or straight line. Is it possible to require users to enter more than a few dots or a line? I'm not trying to verify a name or full signature, just that they drew more than a tiny signature. Thank you in advance.

Jon
  • 1
  • 1

2 Answers2

1

You can also validate for a minimum number of xy points in signaturePad.toData(). Here's an example validation method that looks for a minimum number of points.

hasComplexity(pad: SignaturePad, complexity?: number) {
  if (!complexity) {
    complexity = 10;
  }
  const points = pad.toData();
  const pointCount = [].concat.apply([], points).length;
  return points && pointCount >= complexity;
}

Usage example:

const isValid = this.hasComplexity(this.pad, 10);
Chad Hedgcock
  • 11,125
  • 3
  • 36
  • 44
0

My suggestion would be take canvas and check pixels

 var p = c.getImageData(x, y, 1, 1).data; 
 var hex = "#" + ("000000" + rgbToHex(p[0], p[1], p[2])).slice(-6);

So you should check how many are not empty.

Source

Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80