Replies: 3 comments 2 replies
-
So. I've still no idea what i am doing, but I fiddled around a bit. I change the createPoint-Method:
Now drawing within the squashed SignaturePad has no offset anymore and it draws where the cursor is. |
Beta Was this translation helpful? Give feedback.
-
It sounds like you want to resize the signature when the canvas size changes. First, that might void the signature in some countries. If that doesn't apply to your situation I think the easiest way is to scale the data points when you write them back to the canvas. signaturePad.fromData(scaleData(data, widthRatio, heightRatio)) |
Beta Was this translation helpful? Give feedback.
-
Where do I find the scaleData() method ? |
Beta Was this translation helpful? Give feedback.
-
Hi everyone.
I am having some trouble using SignaturePad in a responsive way.
SignaturePad is embedded within a website, which could be shown in a desktop browser or a mobile browser.
At the moment, resizing is handled the way it is in the demo:
That works fine. You can resize the browser window or change orientation of the device and it works.
There is just one tiny thing I don't know how to handle.
When the signature is signed on a device in landscape mode, the signature pad is pretty wide.
After the signature is done, the device gets given back to another person, sometimes in portrait mode.
So, in portrait mode, the website gets resized, the signature is still there but the signature pad is now narrow.
So some long names get cut off at the end, because now the long name does not fit anymore in the narrow pad.
Now the other persons presses the "send" button without checking and the cut off signature gets saved as an image.
I tried to not use the above code on resize events.
The result was a scaled down and squished signature on the screen, but it was not cut off.
But if you try to continue the signature, the lines get drawn with an offset. I think they get drawn in relation to the initial size of the canvas.
Any idea how to handle this problem?
And to be honest, I am a backend developer, I have no clue about frontend JavaScript.
Beta Was this translation helpful? Give feedback.
All reactions