jharwig / PPSSignatureView

iOS Signature Capture Demo
MIT License
1.04k stars 234 forks source link

Repopulating Signatures: Some Questions and an Implementation #24

Open MosheBerman opened 8 years ago

MosheBerman commented 8 years ago

Hey Jason,

Thanks for a cool library. It works really well!

I've been using this library in an app at work. We decided that we need to re-populate the screen with a previously captured signature in some use cases. (Say the user signs, but isn't ready to save, but they need to look at some other view controller in the middle of their workflow.)

I got it working, but before setting up a pull request, there are a couple of things I wanted to address.

I tried collecting the vertices as they were generated and then passing them back to addVertex() but the call to glMapBufferOES fails and the log spews a bunch of messages: "Attempting to copy gl buffer prematurely." Since that didn't work, I tried something else.

I added my own target to the pan and tap gesture recognizers and recorded the gesture locations and velocities in their respective views. When the signature view comes back on screen, I play back the gestures and the signature draws appropriately.

Is there a better way to redraw the vertices without mocking the gestures? I'm not so familiar with OpenGL ES, so I might have been missing some setup in my initial implementation.

Also, because my signature view is in a scroll view which jumps when the signature finishes (as a result of some of application logic - it's collecting data then refreshing the screen) there's a streak of "ink" towards the top of the signature view.

One last thing - I'd love to contribute this back to the project (if it's wanted) but I need to clear it with my company for legal reasons. I don't know if they consider the gesture recording/playback mechanism to be their IP. In the meantime, more context on the GL question might help someone else even if I can't.