{"action":"created","comment":{"url":"https://api.github.com/repos/angular/material/pulls/comments/49263105","id":49263105,"diff_hunk":"@@ -323,6 +326,93 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,\n       }\n     }\n \n+    function enableDragging() {\n+      $mdGesture.register(element, 'drag', { horizontal: true });\n+\n+      element\n+        .on('$md.dragstart', onDragStart)\n+        .on('$md.drag', onDrag)\n+        .on('$md.dragend', onDragEnd);\n+\n+      var style = getComputedStyle(element[0]);\n+      var sidenavWidth = parseInt(style.width);\n+      var isRightSidenav = element.hasClass('md-sidenav-right');\n+      var accelerationBound = 10;\n+\n+      var dragCancelled = false;\n+      var dragPercentage;\n+      var lastOpenState;\n+      var lastDistance = 0;\n+      var isQuickDrag = false;\n+\n+      function onDragStart() {\n+        if (element.hasClass('md-locked-open')) {\n+          dragCancelled = true;\n+        } else {\n+          lastOpenState = scope.isOpen;\n+          element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms');\n+        }\n+      }\n+\n+      function onDrag(ev) {\n+        if (dragCancelled) return;\n+\n+        if (!isQuickDrag) {\n+          if (isRightSidenav) isQuickDrag = lastDistance - ev.pointer.distanceX <= -accelerationBound;\n+          else isQuickDrag = lastDistance - ev.pointer.distanceX >= accelerationBound;\n+        } else {\n+          if (isRightSidenav && lastDistance > ev.pointer.distanceX) isQuickDrag = false;\n+          else if (!isRightSidenav && lastDistance < ev.pointer.distanceX) isQuickDrag = false;\n+        }\n+\n+        dragPercentage = Math.round((ev.pointer.distanceX / sidenavWidth) * 100);\n+        if (!isRightSidenav) dragPercentage = 0 - dragPercentage;\n+\n+        if (dragPercentage > 100) dragPercentage = 100;\n+        else if (dragPercentage < 0) dragPercentage = 0;\n+\n+        element.css($mdConstant.CSS.TRANSFORM, 'translate3d(-' + (isRightSidenav ? 100 - dragPercentage : dragPercentage) + '%,0,0)');\n+        lastDistance = ev.pointer.distanceX;\n+      }\n+\n+      function onDragEnd() {\n+        if (dragCancelled) {\n+          dragCancelled = false;\n+          return;\n+        }\n+\n+        var remainingPercentage = 100 - dragPercentage;\n+        var animationTime = 4 * remainingPercentage;\n+        var isOpen = dragPercentage > 50 || isQuickDrag;\n+        if (isRightSidenav) isOpen = !isOpen;\n+\n+        element.css($mdConstant.CSS.TRANSITION_DURATION, animationTime + \"ms\");\n+\n+        if (isOpen) {\n+          element.css($mdConstant.CSS.TRANSFORM, 'translate3d(-100%,0,0)');\n+        } else {\n+          element.css($mdConstant.CSS.TRANSFORM, 'translate3d(-0%,0,0)');\n+        }\n+\n+        // Reset drag\n+        lastDistance = 0;\n+        isQuickDrag = false;\n+        $timeout(onAnimationDone, animationTime, true, (isRightSidenav ? isOpen : !isOpen));","path":"src/components/sidenav/sidenav.js","position":105,"original_position":101,"commit_id":"3e04d293b0b300763a80327285f15ef11c124331","original_commit_id":"fd75cd91ad70125de9f7e89f808b8af14f2ad3c1","user":{"login":"EladBezalel","id":6004537,"avatar_url":"https://avatars.githubusercontent.com/u/6004537?v=3","gravatar_id":"","url":"https://api.github.com/users/EladBezalel","html_url":"https://github.com/EladBezalel","followers_url":"https://api.github.com/users/EladBezalel/followers","following_url":"https://api.github.com/users/EladBezalel/following{/other_user}","gists_url":"https://api.github.com/users/EladBezalel/gists{/gist_id}","starred_url":"https://api.github.com/users/EladBezalel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EladBezalel/subscriptions","organizations_url":"https://api.github.com/users/EladBezalel/orgs","repos_url":"https://api.github.com/users/EladBezalel/repos","events_url":"https://api.github.com/users/EladBezalel/events{/privacy}","received_events_url":"https://api.github.com/users/EladBezalel/received_events","type":"User","site_admin":false},"body":"@DevVersion Don't let this damage your other things going on.\r\n\r\nI just said -\r\n```js\r\n$timeout(onAnimationDone, animationTime, true, (isRightSidenav ? isOpen : !isOpen));\r\n```\r\nis equals to\r\n``` js\r\n$timeout(onAnimationDone, animationTime, true, isRightSidenav);\r\n```","created_at":"2016-01-09T10:59:42Z","updated_at":"2016-01-09T10:59:42Z","html_url":"https://github.com/angular/material/pull/6174#discussion_r49263105","pull_request_url":"https://api.github.com/repos/angular/material/pulls/6174","_links":{"self":{"href":"https://api.github.com/repos/angular/material/pulls/comments/49263105"},"html":{"href":"https://github.com/angular/material/pull/6174#discussion_r49263105"},"pull_request":{"href":"https://api.github.com/repos/angular/material/pulls/6174"}}},"pull_request":{"url":"https://api.github.com/repos/angular/material/pulls/6174","id":53035148,"html_url":"https://github.com/angular/material/pull/6174","diff_url":"https://github.com/angular/material/pull/6174.diff","patch_url":"https://github.com/angular/material/pull/6174.patch","issue_url":"https://api.github.com/repos/angular/material/issues/6174","number":6174,"state":"open","locked":false,"title":"feat(sidenav): add gestures to sidenav to allow dragging the sidenav","user":{"login":"DevVersion","id":4987015,"avatar_url":"https://avatars.githubusercontent.com/u/4987015?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVersion","html_url":"https://github.com/DevVersion","followers_url":"https://api.github.com/users/DevVersion/followers","following_url":"https://api.github.com/users/DevVersion/following{/other_user}","gists_url":"https://api.github.com/users/DevVersion/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVersion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVersion/subscriptions","organizations_url":"https://api.github.com/users/DevVersion/orgs","repos_url":"https://api.github.com/users/DevVersion/repos","events_url":"https://api.github.com/users/DevVersion/events{/privacy}","received_events_url":"https://api.github.com/users/DevVersion/received_events","type":"User","site_admin":false},"body":"I'm currently working on the feature, which allows to drag the sidenav.\r\n**Note** -> this is a `Work in Progress` Branch, so please don't expect to much.\r\n\r\nBut I would be very happy for suggestions and tips (but remember: `WIP`-Branch)\r\n\r\n@jelbourn would be great if you take a look at the first state of WIP\r\n\r\n**TODOS**\r\n- [x] Clean the code\r\n- [X] Make the code more clear (comments etc.)\r\n- [X] Add an attribute for disabling dragging\r\n\r\nFixes #1591 Fixes #35","created_at":"2015-12-08T20:39:00Z","updated_at":"2016-01-09T10:59:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"937e7058be90b13c7120f3fdeecb50d8f7855820","assignee":{"login":"EladBezalel","id":6004537,"avatar_url":"https://avatars.githubusercontent.com/u/6004537?v=3","gravatar_id":"","url":"https://api.github.com/users/EladBezalel","html_url":"https://github.com/EladBezalel","followers_url":"https://api.github.com/users/EladBezalel/followers","following_url":"https://api.github.com/users/EladBezalel/following{/other_user}","gists_url":"https://api.github.com/users/EladBezalel/gists{/gist_id}","starred_url":"https://api.github.com/users/EladBezalel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EladBezalel/subscriptions","organizations_url":"https://api.github.com/users/EladBezalel/orgs","repos_url":"https://api.github.com/users/EladBezalel/repos","events_url":"https://api.github.com/users/EladBezalel/events{/privacy}","received_events_url":"https://api.github.com/users/EladBezalel/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/angular/material/pulls/6174/commits","review_comments_url":"https://api.github.com/repos/angular/material/pulls/6174/comments","review_comment_url":"https://api.github.com/repos/angular/material/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/material/issues/6174/comments","statuses_url":"https://api.github.com/repos/angular/material/statuses/3e04d293b0b300763a80327285f15ef11c124331","head":{"label":"DevVersion:wip/sidenav-dragable","ref":"wip/sidenav-dragable","sha":"3e04d293b0b300763a80327285f15ef11c124331","user":{"login":"DevVersion","id":4987015,"avatar_url":"https://avatars.githubusercontent.com/u/4987015?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVersion","html_url":"https://github.com/DevVersion","followers_url":"https://api.github.com/users/DevVersion/followers","following_url":"https://api.github.com/users/DevVersion/following{/other_user}","gists_url":"https://api.github.com/users/DevVersion/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVersion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVersion/subscriptions","organizations_url":"https://api.github.com/users/DevVersion/orgs","repos_url":"https://api.github.com/users/DevVersion/repos","events_url":"https://api.github.com/users/DevVersion/events{/privacy}","received_events_url":"https://api.github.com/users/DevVersion/received_events","type":"User","site_admin":false},"repo":{"id":45487944,"name":"material","full_name":"DevVersion/material","owner":{"login":"DevVersion","id":4987015,"avatar_url":"https://avatars.githubusercontent.com/u/4987015?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVersion","html_url":"https://github.com/DevVersion","followers_url":"https://api.github.com/users/DevVersion/followers","following_url":"https://api.github.com/users/DevVersion/following{/other_user}","gists_url":"https://api.github.com/users/DevVersion/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVersion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVersion/subscriptions","organizations_url":"https://api.github.com/users/DevVersion/orgs","repos_url":"https://api.github.com/users/DevVersion/repos","events_url":"https://api.github.com/users/DevVersion/events{/privacy}","received_events_url":"https://api.github.com/users/DevVersion/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DevVersion/material","description":"Material design for Angular","fork":true,"url":"https://api.github.com/repos/DevVersion/material","forks_url":"https://api.github.com/repos/DevVersion/material/forks","keys_url":"https://api.github.com/repos/DevVersion/material/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DevVersion/material/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DevVersion/material/teams","hooks_url":"https://api.github.com/repos/DevVersion/material/hooks","issue_events_url":"https://api.github.com/repos/DevVersion/material/issues/events{/number}","events_url":"https://api.github.com/repos/DevVersion/material/events","assignees_url":"https://api.github.com/repos/DevVersion/material/assignees{/user}","branches_url":"https://api.github.com/repos/DevVersion/material/branches{/branch}","tags_url":"https://api.github.com/repos/DevVersion/material/tags","blobs_url":"https://api.github.com/repos/DevVersion/material/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DevVersion/material/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DevVersion/material/git/refs{/sha}","trees_url":"https://api.github.com/repos/DevVersion/material/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DevVersion/material/statuses/{sha}","languages_url":"https://api.github.com/repos/DevVersion/material/languages","stargazers_url":"https://api.github.com/repos/DevVersion/material/stargazers","contributors_url":"https://api.github.com/repos/DevVersion/material/contributors","subscribers_url":"https://api.github.com/repos/DevVersion/material/subscribers","subscription_url":"https://api.github.com/repos/DevVersion/material/subscription","commits_url":"https://api.github.com/repos/DevVersion/material/commits{/sha}","git_commits_url":"https://api.github.com/repos/DevVersion/material/git/commits{/sha}","comments_url":"https://api.github.com/repos/DevVersion/material/comments{/number}","issue_comment_url":"https://api.github.com/repos/DevVersion/material/issues/comments{/number}","contents_url":"https://api.github.com/repos/DevVersion/material/contents/{+path}","compare_url":"https://api.github.com/repos/DevVersion/material/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DevVersion/material/merges","archive_url":"https://api.github.com/repos/DevVersion/material/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DevVersion/material/downloads","issues_url":"https://api.github.com/repos/DevVersion/material/issues{/number}","pulls_url":"https://api.github.com/repos/DevVersion/material/pulls{/number}","milestones_url":"https://api.github.com/repos/DevVersion/material/milestones{/number}","notifications_url":"https://api.github.com/repos/DevVersion/material/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DevVersion/material/labels{/name}","releases_url":"https://api.github.com/repos/DevVersion/material/releases{/id}","created_at":"2015-11-03T18:45:53Z","updated_at":"2015-11-05T13:47:22Z","pushed_at":"2016-01-09T10:35:47Z","git_url":"git://github.com/DevVersion/material.git","ssh_url":"git@github.com:DevVersion/material.git","clone_url":"https://github.com/DevVersion/material.git","svn_url":"https://github.com/DevVersion/material","homepage":"https://material.angularjs.org/","size":58670,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"226f72f0accb8c3bc9da805dfc3e50bb3f72c7ed","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":21399598,"name":"material","full_name":"angular/material","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/material","description":"Material design for Angular","fork":false,"url":"https://api.github.com/repos/angular/material","forks_url":"https://api.github.com/repos/angular/material/forks","keys_url":"https://api.github.com/repos/angular/material/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/material/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/material/teams","hooks_url":"https://api.github.com/repos/angular/material/hooks","issue_events_url":"https://api.github.com/repos/angular/material/issues/events{/number}","events_url":"https://api.github.com/repos/angular/material/events","assignees_url":"https://api.github.com/repos/angular/material/assignees{/user}","branches_url":"https://api.github.com/repos/angular/material/branches{/branch}","tags_url":"https://api.github.com/repos/angular/material/tags","blobs_url":"https://api.github.com/repos/angular/material/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/material/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/material/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/material/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/material/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/material/languages","stargazers_url":"https://api.github.com/repos/angular/material/stargazers","contributors_url":"https://api.github.com/repos/angular/material/contributors","subscribers_url":"https://api.github.com/repos/angular/material/subscribers","subscription_url":"https://api.github.com/repos/angular/material/subscription","commits_url":"https://api.github.com/repos/angular/material/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/material/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/material/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/material/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/material/contents/{+path}","compare_url":"https://api.github.com/repos/angular/material/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/material/merges","archive_url":"https://api.github.com/repos/angular/material/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/material/downloads","issues_url":"https://api.github.com/repos/angular/material/issues{/number}","pulls_url":"https://api.github.com/repos/angular/material/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/material/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/material/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/material/labels{/name}","releases_url":"https://api.github.com/repos/angular/material/releases{/id}","created_at":"2014-07-01T19:20:06Z","updated_at":"2016-01-09T04:44:28Z","pushed_at":"2016-01-09T10:35:47Z","git_url":"git://github.com/angular/material.git","ssh_url":"git@github.com:angular/material.git","clone_url":"https://github.com/angular/material.git","svn_url":"https://github.com/angular/material","homepage":"https://material.angularjs.org/","size":62881,"stargazers_count":12079,"watchers_count":12079,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2261,"mirror_url":null,"open_issues_count":1558,"forks":2261,"open_issues":1558,"watchers":12079,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/material/pulls/6174"},"html":{"href":"https://github.com/angular/material/pull/6174"},"issue":{"href":"https://api.github.com/repos/angular/material/issues/6174"},"comments":{"href":"https://api.github.com/repos/angular/material/issues/6174/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/material/pulls/6174/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/material/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/material/pulls/6174/commits"},"statuses":{"href":"https://api.github.com/repos/angular/material/statuses/3e04d293b0b300763a80327285f15ef11c124331"}}}}