{"action":"created","issue":{"url":"https://api.github.com/repos/Gamua/Sparrow-Framework/issues/53","labels_url":"https://api.github.com/repos/Gamua/Sparrow-Framework/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/Gamua/Sparrow-Framework/issues/53/comments","events_url":"https://api.github.com/repos/Gamua/Sparrow-Framework/issues/53/events","html_url":"https://github.com/Gamua/Sparrow-Framework/pull/53","id":130166685,"number":53,"title":"Resolving dropped/lost intra-frame rapid touches ","user":{"login":"hobsynth","id":6754182,"avatar_url":"https://avatars.githubusercontent.com/u/6754182?v=3","gravatar_id":"","url":"https://api.github.com/users/hobsynth","html_url":"https://github.com/hobsynth","followers_url":"https://api.github.com/users/hobsynth/followers","following_url":"https://api.github.com/users/hobsynth/following{/other_user}","gists_url":"https://api.github.com/users/hobsynth/gists{/gist_id}","starred_url":"https://api.github.com/users/hobsynth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hobsynth/subscriptions","organizations_url":"https://api.github.com/users/hobsynth/orgs","repos_url":"https://api.github.com/users/hobsynth/repos","events_url":"https://api.github.com/users/hobsynth/events{/privacy}","received_events_url":"https://api.github.com/users/hobsynth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-31T18:47:35Z","updated_at":"2016-02-01T19:44:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Gamua/Sparrow-Framework/pulls/53","html_url":"https://github.com/Gamua/Sparrow-Framework/pull/53","diff_url":"https://github.com/Gamua/Sparrow-Framework/pull/53.diff","patch_url":"https://github.com/Gamua/Sparrow-Framework/pull/53.patch"},"body":"I’ve been dealing with an issue of dropped/lost touches.  I’m working on an app that allows for extremely rapid multiple touches.\r\n\r\nA 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. \r\n\r\nI’m really interested to see if anyone can solve this issue in a better and more optimized way.\r\n\r\nI’ve tried a few approaches but this one seemed to work the best.\r\n\r\n[ 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. ] \r\n\r\nBefore 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.\r\n \r\nThanks in advance.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Gamua/Sparrow-Framework/issues/comments/178151065","html_url":"https://github.com/Gamua/Sparrow-Framework/pull/53#issuecomment-178151065","issue_url":"https://api.github.com/repos/Gamua/Sparrow-Framework/issues/53","id":178151065,"user":{"login":"racarone","id":1103284,"avatar_url":"https://avatars.githubusercontent.com/u/1103284?v=3","gravatar_id":"","url":"https://api.github.com/users/racarone","html_url":"https://github.com/racarone","followers_url":"https://api.github.com/users/racarone/followers","following_url":"https://api.github.com/users/racarone/following{/other_user}","gists_url":"https://api.github.com/users/racarone/gists{/gist_id}","starred_url":"https://api.github.com/users/racarone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/racarone/subscriptions","organizations_url":"https://api.github.com/users/racarone/orgs","repos_url":"https://api.github.com/users/racarone/repos","events_url":"https://api.github.com/users/racarone/events{/privacy}","received_events_url":"https://api.github.com/users/racarone/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T19:44:25Z","updated_at":"2016-02-01T19:44:25Z","body":"I took a look at this and you are right again! Touches were completely lost due to this bug. I liked your commit, but I fixed and cleaned this up in #f3d44f0. Instead getting an IndexSet for the duplicate IDs, I'm just checking the `_updatedTouches` set for inclusion and adding the excess to a separate array and looping. Very similar, just a little more performant. Thanks for pull request, this definitely needed to be addressed!"}}