-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example with modal, aspect ratio, and hooks #44
Comments
Sorry, but this is an awfully specific use-case with a modal and custom behavior like your aspect ratio scaling, not just a pure hooks example. Those features add a lot of complexity that's unnecessary for many, if not most, users. As such, there's a pretty high chance that an example like this would confuse users, especially beginners, rather than help them. There is also already a pretty good tutorial out there that goes through end-to-end using a modal and React hooks: https://dev.to/ma7eer/create-a-signature-pad-in-react-3mmi I think a modal example and a hooks example could be good to have in the docs, but they would have to be as simple as possible. Also note that Some of what you wrote sounds like you're asking for support for your very specific use-case. This isn't a support forum -- I think that's better suited to a place like StackOverflow (or consulting) than here. I can attempt to help you, but please do not expect that from unpaid open-source maintainers.
See above.
That's passed directly to upstream |
This comment has been minimized.
This comment has been minimized.
Your comment has been marked as abusive for being very condescending. Your methods of doing things are far from the only way of doing things. |
So despite being marked as abusive, locked, and called out, OP decided to continue abusive and condescending behavior by personally emailing & harassing me. Here's a snippet of that email:
OP has been blocked and reported. For other readers, you've probably read some of the issues, PRs, examples, tutorials, etc, and so you probably know that there's quite a bit about mobile in this repo. And if you were to learn about the history of this repo, you'd find it was forked 4 years ago to support an e-sign app that was built for mobile and uses modals. Suffice to say, I've definitely made this work on mobile any number of times... But, unsurprisingly, OP continued making abusive & condescending comments even after being explictly told that. Don't be OP. |
Here's an example of using this package with react hooks, in case it helps someone:
You can see there's some tricky bits, eg I had to use useCallback for the ref instead of just passing a ref, so that I could call resizeCanvas() immediately after the first render.
I wanted the canvas to have the same aspect ratio no matter what the container, so rather than specifying a canvas width I specify an aspect ratio.
Additionally, calling
canvas.getContext('2d').scale(ratio, ratio)
seemed to cause scaling issues rather than solving those scaling issues, so I disabled it here.Finally, for some reason,
sigCanvas.current.toDataURL('image/svg+xml')
just exports PNG not SVG ... any tips on that would be handy.The text was updated successfully, but these errors were encountered: