{"action":"created","comment":{"url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/comments/43657161","id":43657161,"diff_hunk":"@@ -190,19 +200,84 @@ public class InfiniteCarousel: UICollectionView, UICollectionViewDataSource, UIC\n         \n         jumping = false\n         \n-        let jumpDistance = CGFloat(count) * (collectionViewLayout as! Layout).totalItemWidth\n-        let currentOffset = self.contentOffset.x\n-        \n         if focusHeading == .Left {\n-            self.setContentOffset(CGPointMake(currentOffset + jumpDistance, self.contentOffset.y), animated: false)\n+            jump(.Forward)\n         } else {\n-            self.setContentOffset(CGPointMake(currentOffset - jumpDistance, self.contentOffset.y), animated: false)\n+            jump(.Backward)\n         }\n         \n         currentlyFocusedItem = manualFocusCell!.item\n         setNeedsFocusUpdate()\n     }\n     \n+    func scrollToItem(item: Int, animated: Bool) {\n+        if let initialOffset = (self.collectionViewLayout as! Layout).offsetForItemAtIndex(item) {\n+            self.setContentOffset(CGPointMake(initialOffset,self.contentOffset.y), animated: animated)\n+        }\n+        \n+        // Update focus element in case we have it\n+        self.currentlyFocusedItem = item\n+        self.manualFocusCell = NSIndexPath(forItem: self.currentlyFocusedItem, inSection: 0)\n+        self.setNeedsFocusUpdate()\n+    }\n+    \n+    // MARK: - Auto Scroll\n+    \n+    var scrollTimer: NSTimer?\n+    var userInputTimer: NSTimer?\n+    \n+    func beginAutoScroll() {\n+        guard autoScroll else {\n+            return\n+        }\n+        \n+        invalidateTimers()\n+        scrollTimer = NSTimer.scheduledTimerWithTimeInterval(autoScrollTime, target: self,\n+            selector: \"scrollToNextPage\", userInfo: nil, repeats: true)\n+    }\n+    \n+    func pauseAutoScroll() {\n+        guard autoScroll else {\n+            return\n+        }\n+        \n+        invalidateTimers()\n+        userInputTimer = NSTimer.scheduledTimerWithTimeInterval(autoScrollReset, target: self,","path":"Ouroboros/InfiniteCarousel.swift","position":117,"original_position":117,"commit_id":"93952077a784deef1972387e772a4c0560073a4d","original_commit_id":"93952077a784deef1972387e772a4c0560073a4d","user":{"login":"Grigs-b","id":2414632,"avatar_url":"https://avatars.githubusercontent.com/u/2414632?v=3","gravatar_id":"","url":"https://api.github.com/users/Grigs-b","html_url":"https://github.com/Grigs-b","followers_url":"https://api.github.com/users/Grigs-b/followers","following_url":"https://api.github.com/users/Grigs-b/following{/other_user}","gists_url":"https://api.github.com/users/Grigs-b/gists{/gist_id}","starred_url":"https://api.github.com/users/Grigs-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grigs-b/subscriptions","organizations_url":"https://api.github.com/users/Grigs-b/orgs","repos_url":"https://api.github.com/users/Grigs-b/repos","events_url":"https://api.github.com/users/Grigs-b/events{/privacy}","received_events_url":"https://api.github.com/users/Grigs-b/received_events","type":"User","site_admin":false},"body":"I agree with the assessment of just pausing forever rather than triggering a restart here, then checking in one of the updateFocusInContext methods to pause when focusing carousel and start when unfocusing.","created_at":"2015-11-02T17:45:55Z","updated_at":"2015-11-02T17:45:55Z","html_url":"https://github.com/willowtreeapps/ouroboros/pull/13#discussion_r43657161","pull_request_url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/comments/43657161"},"html":{"href":"https://github.com/willowtreeapps/ouroboros/pull/13#discussion_r43657161"},"pull_request":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13","id":49458821,"html_url":"https://github.com/willowtreeapps/ouroboros/pull/13","diff_url":"https://github.com/willowtreeapps/ouroboros/pull/13.diff","patch_url":"https://github.com/willowtreeapps/ouroboros/pull/13.patch","issue_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/13","number":13,"state":"open","locked":false,"title":"Implement auto-scrolling","user":{"login":"ianterrell","id":54963,"avatar_url":"https://avatars.githubusercontent.com/u/54963?v=3","gravatar_id":"","url":"https://api.github.com/users/ianterrell","html_url":"https://github.com/ianterrell","followers_url":"https://api.github.com/users/ianterrell/followers","following_url":"https://api.github.com/users/ianterrell/following{/other_user}","gists_url":"https://api.github.com/users/ianterrell/gists{/gist_id}","starred_url":"https://api.github.com/users/ianterrell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianterrell/subscriptions","organizations_url":"https://api.github.com/users/ianterrell/orgs","repos_url":"https://api.github.com/users/ianterrell/repos","events_url":"https://api.github.com/users/ianterrell/events{/privacy}","received_events_url":"https://api.github.com/users/ianterrell/received_events","type":"User","site_admin":false},"body":"Closes #12","created_at":"2015-11-02T17:14:39Z","updated_at":"2015-11-02T17:45:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b50961e9b34d44f6d6b3d4b28af30334836251f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13/commits","review_comments_url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13/comments","review_comment_url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/comments{/number}","comments_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/13/comments","statuses_url":"https://api.github.com/repos/willowtreeapps/ouroboros/statuses/93952077a784deef1972387e772a4c0560073a4d","head":{"label":"willowtreeapps:feature/auto-scroll","ref":"feature/auto-scroll","sha":"93952077a784deef1972387e772a4c0560073a4d","user":{"login":"willowtreeapps","id":557680,"avatar_url":"https://avatars.githubusercontent.com/u/557680?v=3","gravatar_id":"","url":"https://api.github.com/users/willowtreeapps","html_url":"https://github.com/willowtreeapps","followers_url":"https://api.github.com/users/willowtreeapps/followers","following_url":"https://api.github.com/users/willowtreeapps/following{/other_user}","gists_url":"https://api.github.com/users/willowtreeapps/gists{/gist_id}","starred_url":"https://api.github.com/users/willowtreeapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willowtreeapps/subscriptions","organizations_url":"https://api.github.com/users/willowtreeapps/orgs","repos_url":"https://api.github.com/users/willowtreeapps/repos","events_url":"https://api.github.com/users/willowtreeapps/events{/privacy}","received_events_url":"https://api.github.com/users/willowtreeapps/received_events","type":"Organization","site_admin":false},"repo":{"id":44705186,"name":"ouroboros","full_name":"willowtreeapps/ouroboros","owner":{"login":"willowtreeapps","id":557680,"avatar_url":"https://avatars.githubusercontent.com/u/557680?v=3","gravatar_id":"","url":"https://api.github.com/users/willowtreeapps","html_url":"https://github.com/willowtreeapps","followers_url":"https://api.github.com/users/willowtreeapps/followers","following_url":"https://api.github.com/users/willowtreeapps/following{/other_user}","gists_url":"https://api.github.com/users/willowtreeapps/gists{/gist_id}","starred_url":"https://api.github.com/users/willowtreeapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willowtreeapps/subscriptions","organizations_url":"https://api.github.com/users/willowtreeapps/orgs","repos_url":"https://api.github.com/users/willowtreeapps/repos","events_url":"https://api.github.com/users/willowtreeapps/events{/privacy}","received_events_url":"https://api.github.com/users/willowtreeapps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/willowtreeapps/ouroboros","description":"Infinitely scrolling carousel for tvOS","fork":false,"url":"https://api.github.com/repos/willowtreeapps/ouroboros","forks_url":"https://api.github.com/repos/willowtreeapps/ouroboros/forks","keys_url":"https://api.github.com/repos/willowtreeapps/ouroboros/keys{/key_id}","collaborators_url":"https://api.github.com/repos/willowtreeapps/ouroboros/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/willowtreeapps/ouroboros/teams","hooks_url":"https://api.github.com/repos/willowtreeapps/ouroboros/hooks","issue_events_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/events{/number}","events_url":"https://api.github.com/repos/willowtreeapps/ouroboros/events","assignees_url":"https://api.github.com/repos/willowtreeapps/ouroboros/assignees{/user}","branches_url":"https://api.github.com/repos/willowtreeapps/ouroboros/branches{/branch}","tags_url":"https://api.github.com/repos/willowtreeapps/ouroboros/tags","blobs_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/refs{/sha}","trees_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/trees{/sha}","statuses_url":"https://api.github.com/repos/willowtreeapps/ouroboros/statuses/{sha}","languages_url":"https://api.github.com/repos/willowtreeapps/ouroboros/languages","stargazers_url":"https://api.github.com/repos/willowtreeapps/ouroboros/stargazers","contributors_url":"https://api.github.com/repos/willowtreeapps/ouroboros/contributors","subscribers_url":"https://api.github.com/repos/willowtreeapps/ouroboros/subscribers","subscription_url":"https://api.github.com/repos/willowtreeapps/ouroboros/subscription","commits_url":"https://api.github.com/repos/willowtreeapps/ouroboros/commits{/sha}","git_commits_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/commits{/sha}","comments_url":"https://api.github.com/repos/willowtreeapps/ouroboros/comments{/number}","issue_comment_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/comments{/number}","contents_url":"https://api.github.com/repos/willowtreeapps/ouroboros/contents/{+path}","compare_url":"https://api.github.com/repos/willowtreeapps/ouroboros/compare/{base}...{head}","merges_url":"https://api.github.com/repos/willowtreeapps/ouroboros/merges","archive_url":"https://api.github.com/repos/willowtreeapps/ouroboros/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/willowtreeapps/ouroboros/downloads","issues_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues{/number}","pulls_url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls{/number}","milestones_url":"https://api.github.com/repos/willowtreeapps/ouroboros/milestones{/number}","notifications_url":"https://api.github.com/repos/willowtreeapps/ouroboros/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/willowtreeapps/ouroboros/labels{/name}","releases_url":"https://api.github.com/repos/willowtreeapps/ouroboros/releases{/id}","created_at":"2015-10-21T21:19:24Z","updated_at":"2015-11-02T17:13:17Z","pushed_at":"2015-11-02T17:14:39Z","git_url":"git://github.com/willowtreeapps/ouroboros.git","ssh_url":"git@github.com:willowtreeapps/ouroboros.git","clone_url":"https://github.com/willowtreeapps/ouroboros.git","svn_url":"https://github.com/willowtreeapps/ouroboros","homepage":"","size":50320,"stargazers_count":1,"watchers_count":1,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"develop"}},"base":{"label":"willowtreeapps:develop","ref":"develop","sha":"47e8853fb866e9e00689dcac23058dab511b8b76","user":{"login":"willowtreeapps","id":557680,"avatar_url":"https://avatars.githubusercontent.com/u/557680?v=3","gravatar_id":"","url":"https://api.github.com/users/willowtreeapps","html_url":"https://github.com/willowtreeapps","followers_url":"https://api.github.com/users/willowtreeapps/followers","following_url":"https://api.github.com/users/willowtreeapps/following{/other_user}","gists_url":"https://api.github.com/users/willowtreeapps/gists{/gist_id}","starred_url":"https://api.github.com/users/willowtreeapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willowtreeapps/subscriptions","organizations_url":"https://api.github.com/users/willowtreeapps/orgs","repos_url":"https://api.github.com/users/willowtreeapps/repos","events_url":"https://api.github.com/users/willowtreeapps/events{/privacy}","received_events_url":"https://api.github.com/users/willowtreeapps/received_events","type":"Organization","site_admin":false},"repo":{"id":44705186,"name":"ouroboros","full_name":"willowtreeapps/ouroboros","owner":{"login":"willowtreeapps","id":557680,"avatar_url":"https://avatars.githubusercontent.com/u/557680?v=3","gravatar_id":"","url":"https://api.github.com/users/willowtreeapps","html_url":"https://github.com/willowtreeapps","followers_url":"https://api.github.com/users/willowtreeapps/followers","following_url":"https://api.github.com/users/willowtreeapps/following{/other_user}","gists_url":"https://api.github.com/users/willowtreeapps/gists{/gist_id}","starred_url":"https://api.github.com/users/willowtreeapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willowtreeapps/subscriptions","organizations_url":"https://api.github.com/users/willowtreeapps/orgs","repos_url":"https://api.github.com/users/willowtreeapps/repos","events_url":"https://api.github.com/users/willowtreeapps/events{/privacy}","received_events_url":"https://api.github.com/users/willowtreeapps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/willowtreeapps/ouroboros","description":"Infinitely scrolling carousel for tvOS","fork":false,"url":"https://api.github.com/repos/willowtreeapps/ouroboros","forks_url":"https://api.github.com/repos/willowtreeapps/ouroboros/forks","keys_url":"https://api.github.com/repos/willowtreeapps/ouroboros/keys{/key_id}","collaborators_url":"https://api.github.com/repos/willowtreeapps/ouroboros/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/willowtreeapps/ouroboros/teams","hooks_url":"https://api.github.com/repos/willowtreeapps/ouroboros/hooks","issue_events_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/events{/number}","events_url":"https://api.github.com/repos/willowtreeapps/ouroboros/events","assignees_url":"https://api.github.com/repos/willowtreeapps/ouroboros/assignees{/user}","branches_url":"https://api.github.com/repos/willowtreeapps/ouroboros/branches{/branch}","tags_url":"https://api.github.com/repos/willowtreeapps/ouroboros/tags","blobs_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/refs{/sha}","trees_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/trees{/sha}","statuses_url":"https://api.github.com/repos/willowtreeapps/ouroboros/statuses/{sha}","languages_url":"https://api.github.com/repos/willowtreeapps/ouroboros/languages","stargazers_url":"https://api.github.com/repos/willowtreeapps/ouroboros/stargazers","contributors_url":"https://api.github.com/repos/willowtreeapps/ouroboros/contributors","subscribers_url":"https://api.github.com/repos/willowtreeapps/ouroboros/subscribers","subscription_url":"https://api.github.com/repos/willowtreeapps/ouroboros/subscription","commits_url":"https://api.github.com/repos/willowtreeapps/ouroboros/commits{/sha}","git_commits_url":"https://api.github.com/repos/willowtreeapps/ouroboros/git/commits{/sha}","comments_url":"https://api.github.com/repos/willowtreeapps/ouroboros/comments{/number}","issue_comment_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/comments{/number}","contents_url":"https://api.github.com/repos/willowtreeapps/ouroboros/contents/{+path}","compare_url":"https://api.github.com/repos/willowtreeapps/ouroboros/compare/{base}...{head}","merges_url":"https://api.github.com/repos/willowtreeapps/ouroboros/merges","archive_url":"https://api.github.com/repos/willowtreeapps/ouroboros/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/willowtreeapps/ouroboros/downloads","issues_url":"https://api.github.com/repos/willowtreeapps/ouroboros/issues{/number}","pulls_url":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls{/number}","milestones_url":"https://api.github.com/repos/willowtreeapps/ouroboros/milestones{/number}","notifications_url":"https://api.github.com/repos/willowtreeapps/ouroboros/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/willowtreeapps/ouroboros/labels{/name}","releases_url":"https://api.github.com/repos/willowtreeapps/ouroboros/releases{/id}","created_at":"2015-10-21T21:19:24Z","updated_at":"2015-11-02T17:13:17Z","pushed_at":"2015-11-02T17:14:39Z","git_url":"git://github.com/willowtreeapps/ouroboros.git","ssh_url":"git@github.com:willowtreeapps/ouroboros.git","clone_url":"https://github.com/willowtreeapps/ouroboros.git","svn_url":"https://github.com/willowtreeapps/ouroboros","homepage":"","size":50320,"stargazers_count":1,"watchers_count":1,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13"},"html":{"href":"https://github.com/willowtreeapps/ouroboros/pull/13"},"issue":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/13"},"comments":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/willowtreeapps/ouroboros/statuses/93952077a784deef1972387e772a4c0560073a4d"}}}}