{"action":"created","comment":{"url":"https://api.github.com/repos/uglyDwarf/mickey/pulls/comments/37150697","id":37150697,"diff_hunk":"@@ -216,22 +216,31 @@ static float norm(float val, float limit, float &currentLimit)\n }\n */\n \n-void MickeyTransform::update(float valX, float valY, bool relative, int elapsed, float &x, float &y)\n+void MickeyTransform::update(float valX, float valY, Mickey::Mode mode, int elapsed, float &x, float &y)\n {\n+  if(mode == Mickey::Velocity) {\n+    float dx = valX - prevValX;\n+    float dy = valY - prevValY;\n+    prevValX = valX;\n+    prevValY = valY;\n+    valX = dx*100;\n+    valY = dy*100;\n+  }\n+\n   axis.smooth(valX, valY);\n   if(!calibrating){\n-    if(relative){\n-      axis.step(norm(-valX/maxValX), norm(-valY/maxValY), elapsed, accX, accY);\n-      x = accX;\n-      accX -= x;\n-      y = accY;\n-      accY -= y;\n-    }else{\n-//      x = norm(-valX, maxValX, currMaxValX);\n-//      y = norm(-valY, maxValY, currMaxValY);\n+    if(mode == Mickey::Absolute){\n+      //      x = norm(-valX, maxValX, currMaxValX);\n+      //      y = norm(-valY, maxValY, currMaxValY);\n       x = norm(-valX / maxValX);\n       y = norm(-valY / maxValY);\n       //std::cout<<\"valX: \"<<-valX<<\"=> \"<<x<<\"   Limit: \"<<maxValX<<\"   CurrentLimit:\"<<currMaxValX<<std::endl;\n+    }else{\n+      axis.step(norm(-valX/maxValX), norm(-valY/maxValY), elapsed, accX, accY);\n+      x = accX;\n+      y = accY;\n+      accX = 0;","path":"transform.cpp","position":46,"original_position":46,"commit_id":"962e88803cbdbc7a23c0055034ff9d4406c8929a","original_commit_id":"962e88803cbdbc7a23c0055034ff9d4406c8929a","user":{"login":"trishume","id":887610,"avatar_url":"https://avatars.githubusercontent.com/u/887610?v=3","gravatar_id":"","url":"https://api.github.com/users/trishume","html_url":"https://github.com/trishume","followers_url":"https://api.github.com/users/trishume/followers","following_url":"https://api.github.com/users/trishume/following{/other_user}","gists_url":"https://api.github.com/users/trishume/gists{/gist_id}","starred_url":"https://api.github.com/users/trishume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishume/subscriptions","organizations_url":"https://api.github.com/users/trishume/orgs","repos_url":"https://api.github.com/users/trishume/repos","events_url":"https://api.github.com/users/trishume/events{/privacy}","received_events_url":"https://api.github.com/users/trishume/received_events","type":"User","site_admin":false},"body":"I just moved this around so it was easier to read.","created_at":"2015-08-16T21:28:34Z","updated_at":"2015-08-16T21:28:34Z","html_url":"https://github.com/uglyDwarf/mickey/pull/5#discussion_r37150697","pull_request_url":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/uglyDwarf/mickey/pulls/comments/37150697"},"html":{"href":"https://github.com/uglyDwarf/mickey/pull/5#discussion_r37150697"},"pull_request":{"href":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5","id":42543731,"html_url":"https://github.com/uglyDwarf/mickey/pull/5","diff_url":"https://github.com/uglyDwarf/mickey/pull/5.diff","patch_url":"https://github.com/uglyDwarf/mickey/pull/5.patch","issue_url":"https://api.github.com/repos/uglyDwarf/mickey/issues/5","number":5,"state":"open","locked":false,"title":"Add velocity-based control mode","user":{"login":"trishume","id":887610,"avatar_url":"https://avatars.githubusercontent.com/u/887610?v=3","gravatar_id":"","url":"https://api.github.com/users/trishume","html_url":"https://github.com/trishume","followers_url":"https://api.github.com/users/trishume/followers","following_url":"https://api.github.com/users/trishume/following{/other_user}","gists_url":"https://api.github.com/users/trishume/gists{/gist_id}","starred_url":"https://api.github.com/users/trishume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishume/subscriptions","organizations_url":"https://api.github.com/users/trishume/orgs","repos_url":"https://api.github.com/users/trishume/repos","events_url":"https://api.github.com/users/trishume/events{/privacy}","received_events_url":"https://api.github.com/users/trishume/received_events","type":"User","site_admin":false},"body":"Fixes #4. Adds another radio button for a velocity based control mode. Most of the code in this PR is small changes to refactor the assumption that there are only two modes. The actual velocity control code is in `transform.cpp`'s `update` method.\r\n\r\n@uglyDwarf for review. Since this is a bigger change feel free to suggest better ways to do things and I can tweak this PR.\r\n\r\nThis PR is based on #3 because that hasn't been merged yet and I needed it to test this.\r\n\r\n![screen shot 2015-08-16 at 5 19 29 pm](https://cloud.githubusercontent.com/assets/887610/9295439/f0576bae-443b-11e5-99a0-88b5175910a5.png)\r\n","created_at":"2015-08-16T21:27:32Z","updated_at":"2015-08-16T21:28:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da4c9de38474763c4ada717974617cd4d66ec72d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5/commits","review_comments_url":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5/comments","review_comment_url":"https://api.github.com/repos/uglyDwarf/mickey/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uglyDwarf/mickey/issues/5/comments","statuses_url":"https://api.github.com/repos/uglyDwarf/mickey/statuses/962e88803cbdbc7a23c0055034ff9d4406c8929a","head":{"label":"uglyDwarf:velocity-control","ref":"velocity-control","sha":"962e88803cbdbc7a23c0055034ff9d4406c8929a","user":{"login":"uglyDwarf","id":13319801,"avatar_url":"https://avatars.githubusercontent.com/u/13319801?v=3","gravatar_id":"","url":"https://api.github.com/users/uglyDwarf","html_url":"https://github.com/uglyDwarf","followers_url":"https://api.github.com/users/uglyDwarf/followers","following_url":"https://api.github.com/users/uglyDwarf/following{/other_user}","gists_url":"https://api.github.com/users/uglyDwarf/gists{/gist_id}","starred_url":"https://api.github.com/users/uglyDwarf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uglyDwarf/subscriptions","organizations_url":"https://api.github.com/users/uglyDwarf/orgs","repos_url":"https://api.github.com/users/uglyDwarf/repos","events_url":"https://api.github.com/users/uglyDwarf/events{/privacy}","received_events_url":"https://api.github.com/users/uglyDwarf/received_events","type":"User","site_admin":false},"repo":{"id":39712317,"name":"mickey","full_name":"uglyDwarf/mickey","owner":{"login":"uglyDwarf","id":13319801,"avatar_url":"https://avatars.githubusercontent.com/u/13319801?v=3","gravatar_id":"","url":"https://api.github.com/users/uglyDwarf","html_url":"https://github.com/uglyDwarf","followers_url":"https://api.github.com/users/uglyDwarf/followers","following_url":"https://api.github.com/users/uglyDwarf/following{/other_user}","gists_url":"https://api.github.com/users/uglyDwarf/gists{/gist_id}","starred_url":"https://api.github.com/users/uglyDwarf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uglyDwarf/subscriptions","organizations_url":"https://api.github.com/users/uglyDwarf/orgs","repos_url":"https://api.github.com/users/uglyDwarf/repos","events_url":"https://api.github.com/users/uglyDwarf/events{/privacy}","received_events_url":"https://api.github.com/users/uglyDwarf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uglyDwarf/mickey","description":"Virtual mouse using Linuxtrack","fork":false,"url":"https://api.github.com/repos/uglyDwarf/mickey","forks_url":"https://api.github.com/repos/uglyDwarf/mickey/forks","keys_url":"https://api.github.com/repos/uglyDwarf/mickey/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uglyDwarf/mickey/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uglyDwarf/mickey/teams","hooks_url":"https://api.github.com/repos/uglyDwarf/mickey/hooks","issue_events_url":"https://api.github.com/repos/uglyDwarf/mickey/issues/events{/number}","events_url":"https://api.github.com/repos/uglyDwarf/mickey/events","assignees_url":"https://api.github.com/repos/uglyDwarf/mickey/assignees{/user}","branches_url":"https://api.github.com/repos/uglyDwarf/mickey/branches{/branch}","tags_url":"https://api.github.com/repos/uglyDwarf/mickey/tags","blobs_url":"https://api.github.com/repos/uglyDwarf/mickey/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uglyDwarf/mickey/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uglyDwarf/mickey/git/refs{/sha}","trees_url":"https://api.github.com/repos/uglyDwarf/mickey/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uglyDwarf/mickey/statuses/{sha}","languages_url":"https://api.github.com/repos/uglyDwarf/mickey/languages","stargazers_url":"https://api.github.com/repos/uglyDwarf/mickey/stargazers","contributors_url":"https://api.github.com/repos/uglyDwarf/mickey/contributors","subscribers_url":"https://api.github.com/repos/uglyDwarf/mickey/subscribers","subscription_url":"https://api.github.com/repos/uglyDwarf/mickey/subscription","commits_url":"https://api.github.com/repos/uglyDwarf/mickey/commits{/sha}","git_commits_url":"https://api.github.com/repos/uglyDwarf/mickey/git/commits{/sha}","comments_url":"https://api.github.com/repos/uglyDwarf/mickey/comments{/number}","issue_comment_url":"https://api.github.com/repos/uglyDwarf/mickey/issues/comments{/number}","contents_url":"https://api.github.com/repos/uglyDwarf/mickey/contents/{+path}","compare_url":"https://api.github.com/repos/uglyDwarf/mickey/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uglyDwarf/mickey/merges","archive_url":"https://api.github.com/repos/uglyDwarf/mickey/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uglyDwarf/mickey/downloads","issues_url":"https://api.github.com/repos/uglyDwarf/mickey/issues{/number}","pulls_url":"https://api.github.com/repos/uglyDwarf/mickey/pulls{/number}","milestones_url":"https://api.github.com/repos/uglyDwarf/mickey/milestones{/number}","notifications_url":"https://api.github.com/repos/uglyDwarf/mickey/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uglyDwarf/mickey/labels{/name}","releases_url":"https://api.github.com/repos/uglyDwarf/mickey/releases{/id}","created_at":"2015-07-26T03:34:22Z","updated_at":"2015-07-28T21:54:35Z","pushed_at":"2015-08-16T21:27:33Z","git_url":"git://github.com/uglyDwarf/mickey.git","ssh_url":"git@github.com:uglyDwarf/mickey.git","clone_url":"https://github.com/uglyDwarf/mickey.git","svn_url":"https://github.com/uglyDwarf/mickey","homepage":null,"size":376,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":2,"default_branch":"master"}},"base":{"label":"uglyDwarf:master","ref":"master","sha":"34e849541c1a6bae08c1bd6da7eb1ec77ca8d66e","user":{"login":"uglyDwarf","id":13319801,"avatar_url":"https://avatars.githubusercontent.com/u/13319801?v=3","gravatar_id":"","url":"https://api.github.com/users/uglyDwarf","html_url":"https://github.com/uglyDwarf","followers_url":"https://api.github.com/users/uglyDwarf/followers","following_url":"https://api.github.com/users/uglyDwarf/following{/other_user}","gists_url":"https://api.github.com/users/uglyDwarf/gists{/gist_id}","starred_url":"https://api.github.com/users/uglyDwarf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uglyDwarf/subscriptions","organizations_url":"https://api.github.com/users/uglyDwarf/orgs","repos_url":"https://api.github.com/users/uglyDwarf/repos","events_url":"https://api.github.com/users/uglyDwarf/events{/privacy}","received_events_url":"https://api.github.com/users/uglyDwarf/received_events","type":"User","site_admin":false},"repo":{"id":39712317,"name":"mickey","full_name":"uglyDwarf/mickey","owner":{"login":"uglyDwarf","id":13319801,"avatar_url":"https://avatars.githubusercontent.com/u/13319801?v=3","gravatar_id":"","url":"https://api.github.com/users/uglyDwarf","html_url":"https://github.com/uglyDwarf","followers_url":"https://api.github.com/users/uglyDwarf/followers","following_url":"https://api.github.com/users/uglyDwarf/following{/other_user}","gists_url":"https://api.github.com/users/uglyDwarf/gists{/gist_id}","starred_url":"https://api.github.com/users/uglyDwarf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uglyDwarf/subscriptions","organizations_url":"https://api.github.com/users/uglyDwarf/orgs","repos_url":"https://api.github.com/users/uglyDwarf/repos","events_url":"https://api.github.com/users/uglyDwarf/events{/privacy}","received_events_url":"https://api.github.com/users/uglyDwarf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uglyDwarf/mickey","description":"Virtual mouse using Linuxtrack","fork":false,"url":"https://api.github.com/repos/uglyDwarf/mickey","forks_url":"https://api.github.com/repos/uglyDwarf/mickey/forks","keys_url":"https://api.github.com/repos/uglyDwarf/mickey/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uglyDwarf/mickey/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uglyDwarf/mickey/teams","hooks_url":"https://api.github.com/repos/uglyDwarf/mickey/hooks","issue_events_url":"https://api.github.com/repos/uglyDwarf/mickey/issues/events{/number}","events_url":"https://api.github.com/repos/uglyDwarf/mickey/events","assignees_url":"https://api.github.com/repos/uglyDwarf/mickey/assignees{/user}","branches_url":"https://api.github.com/repos/uglyDwarf/mickey/branches{/branch}","tags_url":"https://api.github.com/repos/uglyDwarf/mickey/tags","blobs_url":"https://api.github.com/repos/uglyDwarf/mickey/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uglyDwarf/mickey/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uglyDwarf/mickey/git/refs{/sha}","trees_url":"https://api.github.com/repos/uglyDwarf/mickey/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uglyDwarf/mickey/statuses/{sha}","languages_url":"https://api.github.com/repos/uglyDwarf/mickey/languages","stargazers_url":"https://api.github.com/repos/uglyDwarf/mickey/stargazers","contributors_url":"https://api.github.com/repos/uglyDwarf/mickey/contributors","subscribers_url":"https://api.github.com/repos/uglyDwarf/mickey/subscribers","subscription_url":"https://api.github.com/repos/uglyDwarf/mickey/subscription","commits_url":"https://api.github.com/repos/uglyDwarf/mickey/commits{/sha}","git_commits_url":"https://api.github.com/repos/uglyDwarf/mickey/git/commits{/sha}","comments_url":"https://api.github.com/repos/uglyDwarf/mickey/comments{/number}","issue_comment_url":"https://api.github.com/repos/uglyDwarf/mickey/issues/comments{/number}","contents_url":"https://api.github.com/repos/uglyDwarf/mickey/contents/{+path}","compare_url":"https://api.github.com/repos/uglyDwarf/mickey/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uglyDwarf/mickey/merges","archive_url":"https://api.github.com/repos/uglyDwarf/mickey/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uglyDwarf/mickey/downloads","issues_url":"https://api.github.com/repos/uglyDwarf/mickey/issues{/number}","pulls_url":"https://api.github.com/repos/uglyDwarf/mickey/pulls{/number}","milestones_url":"https://api.github.com/repos/uglyDwarf/mickey/milestones{/number}","notifications_url":"https://api.github.com/repos/uglyDwarf/mickey/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uglyDwarf/mickey/labels{/name}","releases_url":"https://api.github.com/repos/uglyDwarf/mickey/releases{/id}","created_at":"2015-07-26T03:34:22Z","updated_at":"2015-07-28T21:54:35Z","pushed_at":"2015-08-16T21:27:33Z","git_url":"git://github.com/uglyDwarf/mickey.git","ssh_url":"git@github.com:uglyDwarf/mickey.git","clone_url":"https://github.com/uglyDwarf/mickey.git","svn_url":"https://github.com/uglyDwarf/mickey","homepage":null,"size":376,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5"},"html":{"href":"https://github.com/uglyDwarf/mickey/pull/5"},"issue":{"href":"https://api.github.com/repos/uglyDwarf/mickey/issues/5"},"comments":{"href":"https://api.github.com/repos/uglyDwarf/mickey/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/uglyDwarf/mickey/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uglyDwarf/mickey/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/uglyDwarf/mickey/statuses/962e88803cbdbc7a23c0055034ff9d4406c8929a"}}}}