I am using this Canvas Signature Pad as a user input field for signature. I found part of the code on CodePen and modified it a little bit so that I can resize the Canvas using CSS. To make the Signature and the Canvas scale properly using CSS I had to add this line of code
canvas.width = canvas.scrollWidth;
canvas.height = canvas.scrollHeight;
window.addEventListener('resize', function() {
canvas.width = canvas.scrollWidth;
canvas.height = canvas.scrollHeight;
});
However, every time I resize the Screen the signature disappears. Is there a way to make the Signature persist?