brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
696 stars 529 forks source link

Importing Data to a different sized jSignature #106

Open JasonA86 opened 8 years ago

JasonA86 commented 8 years ago

I am having a problem importing data to a jSignature where the jSignature is a different size from when the signature was saved.

The jSignature on my app is variable sized based on the width of the screen (and thus landscape/portrait). The problem I am having is if someone: -signs the pad in landscape mode. -Goes to another screen. switches to portrait mode -Then returns to the previous page.

In this case the signature changes. It gets shifted because the signature pad is a different size.

I am exporting the signature in base30.

Do you know how to fix this problem?

JasonA86 commented 8 years ago

Nevermind. Now I see that this has already been reported: https://github.com/brinley/jSignature/issues/67

Does anyone have a workaround?

brinley commented 8 years ago

How would you envision this to work? Do you have the signature canvas with the same aspect ratio?

durasj commented 8 years ago

Hello @brinley, I have similar problem. Yes, I think the only way would be to keep aspect ratio. That is something I already do, but transferring signature between devices with different screen sizes/or resizing on device where it is possible still brakes it.

I think some calculations on you native format would be necessary before it can be used, but I am not at home in your code too much nor I have any experience with image processing, canvas etc.

Thanks

brinley commented 8 years ago

Hey @durasj,

I dont believe the solution would require any reprocessing of the image data if aspect ratio is kept. I suspect it would be as simple as modifying getPointFromEvent to check the current scale of the image and adjust the coordinates of to the original image. I dont have time to look into this at the moment. Are you able to have a look at this section considering that you have experimented with signatures on different screen sizes?

Regards, Brinley

JasonA86 commented 8 years ago

I am no longer working on this project and haven't used the signature in a long time. I found a workaround by loading the signature as an image. so, they can never edit their old signature. only view it and then possibly delete and re-sign.

But to solve this problem I think you'd have to store the height and width of the signature. then, when you're loading it, first load it at the original size and then re-size it to fit the screen.