angular2-signaturepad use

For detailed reading this https://blog.csdn.net/qq_29594393/article/details/76913495

npm Address: https://www.npmjs.com/package/signature_pad

Problems encountered

Test page sizes intact, a small mobile terminal initialization pictures

solution

the let Canvas = . Document querySelector ( "Canvas"); 
the let ratio = the Math. max ( window. devicePixelRatio || . 1, . 1);
the let signaWidth = this.platform. width () * 0.92; Ionic // acquisition apparatus used in width
canvas.width = signaWidth;
canvas.height = signaWidth;
. Canvas the getContext ( . "2D") Scale ( ratio, ratio); // this step is the most critical than the column adjust
the this. signaturePad. Clear (); // otherwise isEmpty () Might value in here Incorrect return
the this. signaturePad. fromDataURL (the this. vehicleDamageImage)
// Base64 initialization value of the picture

Guess you like

Origin www.cnblogs.com/wei-dong/p/11058698.html