thread-pond / signature-pad

A jQuery plugin for assisting in the creation of an HTML5 canvas based signature pad. Records the drawn signature in JSON for later regeneration.
BSD 3-Clause "New" or "Revised" License
727 stars 292 forks source link

Mouse-up event not firing when in an iFrame #134

Open morbidcamel101 opened 9 years ago

morbidcamel101 commented 9 years ago

Hi Thomas, great component. I am using your component in an iframe and yes it's a long story but I found using it in this way meant once I started drawing the signature it never stopped because the mouseup event never fired. Well don't fear - I solved it. In my case I had to change initDrawEvents

 } else {
        //$(document).bind('mouseup.signaturepad', function () {
        // FIX: Change this line to 
       canvas.bind('mouseup.signaturepad', function () {
        if (mouseButtonDown) {
          stopDrawing()
          clearMouseLeaveTimeout()
        }
      })
      canvas.bind('mouseleave.signaturepad', function (e) {
        if (mouseButtonDown) stopDrawing(e)
thomasjbradley commented 9 years ago

Thanks for finding this issue.

Could you submit a pull request with your fixes please?