brinley / jSignature

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

Initializing jSignature on hidden container with automatic sizing #165

Open hawajrambo opened 5 years ago

hawajrambo commented 5 years ago

Dear Developer, jSignature calculates with it's container's size at initialization time. In my case, dynamic content is prepared former, but showed at a later time with animation. Because of the animation, the dynamic content is hidden until the animation begins. So, there are "initializing" phase and "showing" phase. Setting up the signature panel's parameters belongs to the initializing. At initialization time, the signature panel's dimensions are 0 x 0, and therefore it doesn't work later. I can call jSignature's onParentResized event, but it isn't public: $("#"+pageName+"-signaturePad").jSignature('globalEvents').topics["jSignature.parentresized"][0][0](); Could you please make a public function for re-rendering the jSignature's canvas with keeping all the settings? Maybe jSignature's initialization could wait for the container gets visible with MutationObserver. Best Regards, Gabor

brinley commented 5 years ago

Did you try calling window.resize?

hawajrambo commented 5 years ago

Thanks. this fixes the problem: $(window).trigger("resize");

Here I wrote for you a test page with 2 more bugs: jSignatureBugs-190318.ZIP Gabor