brinley / jSignature

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

Function to rerender signature(s) after zoom? #88

Open MickL opened 9 years ago

MickL commented 9 years ago

Hey,

im working on a PDF-Viewer and successfully integrated jSignature into it. Thanks for this plugin by the way, its awesome!

I noticed that done signatures are rerendered when resizing the window. Im looking for exactly this function(or lines of code) to call when I zoom in and out of my PDF, so the thickness of the signatures gets rerendered.

I found this function: conditionallyLinkCanvasResizeToWindowResize(jSignatureInstance, settingsWidth, apinamespace, globalEvents) but its very complicated for me. I studied it for some hours but it has so many variables and functions.

Maybe you can give me a hint how i can easily rerender a given field? It would save me sooo many hours... :)

Edit 1:
I found this trick: window.dispatchEvent(new Event('resize'));

But besides of the timeout i dont like, it is only risizing 1 field per zoom. Even when i call it per each field. It looks very weird, because when i have 2 fields, 1 field is resized, and one 1 is not: bildschirmfoto 2015-06-16 um 21 29 14

Edit 2:
Also when i try foreach field

$(this).resize();

It is also resizing only ONE field per zoom. Even when its called for each field.

Edit 3: I ended up commentig the lines so it is no more rerendering at all $(window).bind('resize.'+apinamespace, function()

Greetings

MickL commented 9 years ago

There is definitely a rerender-function needed. A second bug is: When resizing the active signature-field the strokes are not drawn correctly anymore.