-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in fromDataURL for high DPI screen devices #153
Comments
Hi, I also stumbled upon this issue. This is unexpected behavior. I think we should have a choice whether we want such modifications (so second argument defaulting to previous behavior should be fine). Mainly because something like that is not done automatically anywhere else. Thanks a lot @siggifv for your investigation, you saved me some time. Manually populating canvas is the way for now: var image = new Image();
signaturePad.clear();
image.src = dataURL;
image.onload = function () {
signatureCanvas = document.querySelector("#signature-pad");
signatureCanvas.getContext("2d").drawImage(image, 0, 0, width, height);
};
this.signaturePad._isEmpty = false; |
Hi Durasj, |
Hi @durasj Thanks a lot, works perfectly my example with accessor's
|
fixed in #253 |
Description
I've found that the method
fromDataURL
behaves oddly on devices that don't have the pixel ratio 1, e.g. on mobile devices with high DPI.I'm aware of the clause in the README where handling of high DPI screens is discussed.
However, I'm still able to reproduce an issue using
fromDataURL
in cases where the canvas is of a fixed size. I believe that this scaling of the image is the reason for this issue.You can reproduce this issue using this JSFiddle.
Steps to reproduce
Expected outcome
The signature pad should look exactly like it did after step 2.
Actual outcome
The changes on the signature pad are reverted, but the image has been scaled so it looks different from what was on the pad after step 2.
The text was updated successfully, but these errors were encountered: