Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.

Problem when show/hide the canvas #71

Open
n2lose opened this issue Oct 11, 2017 · 5 comments
Open

Problem when show/hide the canvas #71

n2lose opened this issue Oct 11, 2017 · 5 comments

Comments

@n2lose
Copy link

n2lose commented Oct 11, 2017

I am having an issue when show/hide the canvas.
I created a page using bootstrap tabs, on each tabs, i have an signature canvas.
In first time page loaded, the canvas display well on 2 tabs, but when switch back tabs, the width/height of that canvas set to 0.
As i debugging it, the function calculateScale() called to calculate the width/height and ratio of canvas, but when the canvas is hidden, it can't get the width/height.

How can i re-call to init width/height from the values that passed as property param in the directive?

<div class="container" style="max-width: 700px; max-height: 300px">
    <signature-pad accept="accept" clear="clear" height="220" width="568" dataurl="dataurl"></signature-pad>
@ahovingh
Copy link

I've also been having this problem. I ended up with a workaround of sorts. If you set the height on the .signature class with !important, it should do the trick. Just make sure that value is bigger than the height you specified on the control itself as it limits it with max-height.

@n2lose
Copy link
Author

n2lose commented Dec 22, 2017

@ahovingh : Could you show your workaround? I also fixed it by the way added an timeout to calculate with/height of that canvas containner. But it raise another problem, when you clear, the scale set to 0, the cursor point to a place but signature draw another place( as you zoom in)

@glaidler
Copy link

Hi, I can't get this workaround working; using ng-show and ng-hide / or ng-if doesn't work with this directive.

@n2lose
Copy link
Author

n2lose commented Jan 15, 2018

@glaidler : workaround just need to re-call the function calculateScale to re-calculate width/height of signatures

@fjaxyu
Copy link

fjaxyu commented Mar 12, 2018

I was experiencing a similar problem where the signature-pad canvas was height: 0, width: 0. My workaround was adding a style to the <signature-pad style="min-height: 200px; min-width: 500px;" ...>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants