brinley / jSignature

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

jSignature resize and visibility #130

Open aljscott opened 7 years ago

aljscott commented 7 years ago

I've just diagnosed an issue with jSignature resizing.

We had a situation with multiple jSignature controls was one instance was hidden and a window resize occurred / device rotation. If you look at the function: function conditionallyLinkCanvasResizeToWindowResize(jSignatureInstance, settingsWidth, apinamespace, globalEvents) It evaluates $parent.width() which returns 0 if the control is hidden. The resize calculates the scale using w * 1.0 / originalParentWidth When w = 0, it then multiples all the points by zero and corrupts the signature data.

Would it be possible to commit a fix that checks the width > 0 to prevent data loss.