javascript for various functions
This commit is contained in:
21
assets/js/app/user.js
Normal file
21
assets/js/app/user.js
Normal file
@@ -0,0 +1,21 @@
|
||||
export function createSignatureBlock() {
|
||||
pad = new SignaturePad(document.getElementById('signature_pad'));
|
||||
const ratio = Math.max(window.devicePixelRatio || 1, 1);
|
||||
canvas.width = canvas.offsetWidth * ratio;
|
||||
canvas.height = canvas.offsetHeight * ratio;
|
||||
canvas.getContext("2d").scale(ratio, ratio);
|
||||
//pad.clear(); // otherwise isEmpty() might return incorrect value
|
||||
}
|
||||
|
||||
export function clearSignatureBlock() {
|
||||
//const pad = new SignaturePad(document.getElementById('signature_pad'));
|
||||
pad.clear();
|
||||
}
|
||||
|
||||
export function saveSignatureBlock() {
|
||||
//const pad = new SignaturePad(document.getElementById('signature_pad'));
|
||||
const data = pad.toData();
|
||||
document.getElementById('signature').value = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user