3

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?

Machavity
  • 30,841
  • 27
  • 92
  • 100
greenn
  • 309
  • 1
  • 6
  • 18
  • Possible duplicate of [HTML5 responsive canvas: resizing the browser canvas draw disappear](https://stackoverflow.com/questions/15878377/html5-responsive-canvas-resizing-the-browser-canvas-draw-disappear) – Helder Sepulveda Sep 26 '18 at 13:17

0 Answers0