using Signature-Pad and as it's being used to enter a quick sketch rather than a signature, want to be able to allow the user to rotate the phone/ipad and continue to draw.
using the example:
function resizeCanvas() {
dta = signaturePad.toData();
var ratio = Math.max(window.devicePixelRatio || 1, 1);
// This part causes the canvas to be cleared
canvas.width = canvas.offsetWidth * ratio;
canvas.height = canvas.offsetHeight * ratio;
canvas.getContext("2d").scale(ratio, ratio);
signaturePad.fromData(dta);
}
but while this preserves the image, when I attempt to draw on it after rotation the offset/scale is wrong.
if I change the last line to signaturePad.clear();
to reset, then positioning and scale is right for the new drawing.
I also tried setting the {ratio, width, height, xOffset, yOffset}
when doing a fromDataURL
on the stored image and get the same problem