Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Fixed race condition that affected Android + Chrome on mobile when a "sc... #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

patricknelson
Copy link

I ended up with a race condition that affected Android + Chrome on mobile when a "scratchDown" callback was also setup. What happened was that the callback was being called with this._scratchPercent() being executed, which took some time in portrait mode but interestingly not landscape. Anyway, this caused Chrome 35 to automatically trigger a touchcancel event since it took longer than 200ms to respond, which foobar'ed everything, causing touchmove events never to be fired and thus created bullet holes instead of lines when attempting to scratch (just dropped a circle and did nothing else).

Fixed involves deferring callbacks via setTimeout() so that touchstart will return immediately. I also modified the logic on firing callbacks slightly to just exclude scratchMove if not currently set to realtime in the options.

…"scratchDown" callback was also setup. Fixed involves deferring callbacks so that "touchstart" will return immediately on touch devices due to delay caused by calculating percentage which is passed into all callbacks (including 'down'). Chrome will trigger a "touchcancel" event if not responding after 200ms. Also ensuring all callbacks (down/move/up) are called all the time except "move" which should be called only when "realtime" is set.
@patricknelson
Copy link
Author

Do you happen to maintain this repo anymore? Just curious.

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

Successfully merging this pull request may close these issues.

1 participant