brinley / jSignature

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

Strokes are not being rendered #153

Closed danbliss97 closed 6 years ago

danbliss97 commented 6 years ago

We are using JSignature in a cordova application and are seeing an issue on some android devices where strokes are being recorded but not rendered. Weirdly, if you tap a text entry field to open the keyboard the strokes are now rendered and will continue to be rendered as you add more strokes.

I've been looking at this for a few days now and haven't been able to figure anything out, any suggestions to what might be wrong?

brinley commented 6 years ago

I believe the event object is slightly different for multi touch devices but if the stroke is rendering when you tap else where then perhaps the event that triggers the render IIRC ontouchend is not getting triggered. Can you check that? Unfortunately I don’t have the time to look deeper into this issue, but if you can fix the issue I would be more than happy to review the PR.

brinley commented 6 years ago

See if something like https://github.com/d3/d3-zoom/issues/120 will solve the issue

danbliss97 commented 6 years ago

I've checked and it's definitely calling ontouchend.

I should add also, after having tapped in the text entry to render the strokes, any further strokes are rendered as normal.

brinley commented 6 years ago

Can you debug the movementHandlers drawEndHandler and drawStartHandler if they are being called correctly? If thats fine, check DataEngine's startStroke, after that the last place to check is strokeStartCallback which updates the canvas. The issue should be somewhere along that flow

danbliss97 commented 6 years ago

Upon further investigation, I have found this line in logcat showing repeatedly while attempting to draw a signature:

"WebViewInputDispatcher: Webkit prevent current and last event, cancel ui event."

Seems like it might be a clue to the issue, I will continue to investigate.

danbliss97 commented 6 years ago

I solved this a week ago but forgot to update here.

I fixed my issue by copying over the newest files from here and re-writing our custom code. There must have been something missing I didn't spot because it was as simple as that.