Open LJ-03 opened 2 years ago
I have the same issue...
I have the same issue. Any update on this?
I recognised a pattern: the more the cursor is moved on the x-axis or y-axis, the more the offset is.
https://user-images.githubusercontent.com/8343/209366645-d4b31097-c9d7-4a9a-b3ac-2ef78f958e20.mov
Figured out, that if you're define the width of the canvas, everything works fine. e.g.:
canvas {
display: block;
margin: 0 auto;
border: 1px solid #000;
width: 70%;
}
Sadly @koos suggestion did not work for me. I had to update the scale in the resizeCanvas
function:
This didn't work:
function resizeCanvas() {
var ratio = Math.max(window.devicePixelRatio || 1, 1);
canvas.width = 500;
canvas.height = 300;
canvas.getContext("2d").scale(ratio, ratio);
signaturePad.clear();
}
Updating it to:
function resizeCanvas() {
canvas.width = 500;
canvas.height = 300;
canvas.getContext("2d").scale(1, 1)
signaturePad.clear();
}
fixed my problem.
Bear in mind, the vendored version of signature_pad is approximately ~5 years outdated by this point.
When I draw a signature, it's offset downward and to the right of where the cursor is.
So like,