brinley / jSignature

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

importData not working #10

Closed hariharan7 closed 12 years ago

hariharan7 commented 12 years ago

I tried testing the importData functionality. It says that the method is not defined. Is there something i might have missed out? It gives the same error on your demo page as well. Pls clarify. The error says "method importData does not exist on jQuery.jSignature"

Thanks, hari

brinley commented 12 years ago

There have been some major changes between v1 and v2 and not all the changes are well documented yet. See https://github.com/brinley/jSignature/blob/master/README.md Anyway, I've just pushed up an update for backwards compatibility and should resolve the importData functionality.

dvdotsenko commented 12 years ago

Was there an "importData" method before? If so, my bad, I don't remember seeing it around.

Per docs (see API section): http://willowsystems.github.com/jSignature/#/

there is "setData", not "importData".

I'll take a look at old code and will roll in an alias "importData" = "setData"

Daniel.

brinley commented 12 years ago

I've just commited an importData which uses setData rather than just an alias. The problem is originally I had the importData accept the dataurl as a string rather than an array which setData now does so I've had to add code to translate it. Feel free to improve that. The other thing I noticed is that the previous bitmap approach does not work anymore due to it buggy nature, however can we still add an importhandler so that users who have stored image data in that format can still use it with the knowledge that it will cause issues?

dvdotsenko commented 12 years ago

Ugh! Sorry about that "clear" - "reset" thing. By the time got around to putting the "reset" together, forgot to check with old API.

dvdotsenko commented 12 years ago

By the way:

setData takes two arguments - data object, data format name. When data object is a string formatted in data-url pattern you don't need to specify the data dormat name. The data format name (mime) will be implied from the data-url prefix.

So you don't need to split it. It can probably be an alias.

Still, there is no plugin that handles "png" import. In other words, setData / importData + "data:image/png....." will take the string but will not render it. I will roll a plug in for "image/[png/jpeg/etc] later today. Then this fix will be complete.

dvdotsenko commented 12 years ago

Should be fixed with pull https://github.com/brinley/jSignature/pull/11