Resolving dropped/lost intra-frame rapid touches #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I’ve been dealing with an issue of dropped/lost touches. I’m working on an app that allows for extremely rapid multiple touches.
A situation exists now in SPTouchProcessor, where when a touch’s phase changes within the period of a single frame, the last phase overwrites the previous. This may mean that you only get SPTouchPhaseEnded without ever seeing the initial SPTouchPhaseBegan. That represents a dropped touch. Of course, you really have to tap fast in order to re-create this issue. It’s easy to see if the frame rate drops a bit and you’re on a slower device.
I’m really interested to see if anyone can solve this issue in a better and more optimized way.
I’ve tried a few approaches but this one seemed to work the best.
[ Move any matching touches onto a temporary queue. Dispatch the normal queue as usually and then, right after, reprocess the matching touches queue before the next frame. Even though you’ll see these touches fire out at nearly the same time, the point is that all phases still fire and in the correct order. ]
Before we merge this, I’d really like some feedback about performance. I’m guessing there is either a better approach or at least, way to improve the performance.
Thanks in advance.