{"action":"created","comment":{"url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/comments/77571065","id":77571065,"diff_hunk":"@@ -419,6 +419,50 @@ function VectorDrawXBlock(runtime, element, init_args) {\n         return targetObjects\n     }\n \n+    VectorDraw.prototype.preventDefault = function(e) {\n+        // for disabling scroll http://stackoverflow.com/a/4770179/2747370\n+        e = e || window.event;\n+        if (e.preventDefault){\n+            e.preventDefault();\n+        }\n+        e.returnValue = false;\n+    }\n+\n+    VectorDraw.prototype.preventDefaultForScrollKeys = function(e) {\n+        // for disabling scroll http://stackoverflow.com/a/4770179/2747370\n+        var keys = {37: 1, 38: 1, 39: 1, 40: 1};\n+        if (keys[e.keyCode]) {\n+            this.preventDefault(e);\n+            return false;\n+        }\n+    }\n+\n+    VectorDraw.prototype.disableScroll = function() {\n+        // for disabling scroll http://stackoverflow.com/a/4770179/2747370\n+        var preventDefault = this.preventDefault;\n+        var preventDefaultForScrollKeys = this.preventDefaultForScrollKeys;\n+        if (window.addEventListener){ // older FF\n+            window.addEventListener('DOMMouseScroll', preventDefault, false);\n+        }\n+        window.onwheel = preventDefault; // modern standard\n+        window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE\n+        window.ontouchmove  = preventDefault; // mobile\n+        document.onkeydown  = preventDefaultForScrollKeys;\n+    }\n+\n+    VectorDraw.prototype.enableScroll = function() {\n+        // for disabling scroll http://stackoverflow.com/a/4770179/2747370\n+        var preventDefault = this.preventDefault;\n+        var preventDefaultForScrollKeys = this.preventDefaultForScrollKeys;","path":"vectordraw/public/js/vectordraw.js","position":38,"original_position":38,"commit_id":"0cda22ba55acb67b17ec4bd25feccc7c9379569f","original_commit_id":"0cda22ba55acb67b17ec4bd25feccc7c9379569f","user":{"login":"pomegranited","id":7556571,"avatar_url":"https://avatars.githubusercontent.com/u/7556571?v=3","gravatar_id":"","url":"https://api.github.com/users/pomegranited","html_url":"https://github.com/pomegranited","followers_url":"https://api.github.com/users/pomegranited/followers","following_url":"https://api.github.com/users/pomegranited/following{/other_user}","gists_url":"https://api.github.com/users/pomegranited/gists{/gist_id}","starred_url":"https://api.github.com/users/pomegranited/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pomegranited/subscriptions","organizations_url":"https://api.github.com/users/pomegranited/orgs","repos_url":"https://api.github.com/users/pomegranited/repos","events_url":"https://api.github.com/users/pomegranited/events{/privacy}","received_events_url":"https://api.github.com/users/pomegranited/received_events","type":"User","site_admin":false},"body":"`preventDefaultForScrollKeys` is not used in this function.","created_at":"2016-09-06T04:06:10Z","updated_at":"2016-09-06T04:06:10Z","html_url":"https://github.com/open-craft/xblock-vectordraw/pull/12#discussion_r77571065","pull_request_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/comments/77571065"},"html":{"href":"https://github.com/open-craft/xblock-vectordraw/pull/12#discussion_r77571065"},"pull_request":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12","id":84030938,"html_url":"https://github.com/open-craft/xblock-vectordraw/pull/12","diff_url":"https://github.com/open-craft/xblock-vectordraw/pull/12.diff","patch_url":"https://github.com/open-craft/xblock-vectordraw/pull/12.patch","issue_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/12","number":12,"state":"open","locked":false,"title":"Disable scroll when \"drawmode\" enabled.","user":{"login":"bdero","id":919017,"avatar_url":"https://avatars.githubusercontent.com/u/919017?v=3","gravatar_id":"","url":"https://api.github.com/users/bdero","html_url":"https://github.com/bdero","followers_url":"https://api.github.com/users/bdero/followers","following_url":"https://api.github.com/users/bdero/following{/other_user}","gists_url":"https://api.github.com/users/bdero/gists{/gist_id}","starred_url":"https://api.github.com/users/bdero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdero/subscriptions","organizations_url":"https://api.github.com/users/bdero/orgs","repos_url":"https://api.github.com/users/bdero/repos","events_url":"https://api.github.com/users/bdero/events{/privacy}","received_events_url":"https://api.github.com/users/bdero/received_events","type":"User","site_admin":false},"body":"This is a port of the change from https://github.com/open-craft/jsinput-vectordraw/pull/31.\r\n\r\n\r\n### Testing instructions (Using an Android or IOS browser):\r\n1. Setup a devstack.\r\n1. Install this xblock on this branch into the edxapp Python virtualenv.\r\n\r\n    ```bash\r\n# In the same directory as your Vagrantfile:\r\nvagrant ssh -- sudo -u edxapp /edx/bin/pip.edxapp install -e git+https://github.com/open-craft/xblock-vectordraw.git@bdero/port-mobile-dragging-fix#egg=vectordraw-xblock\r\n    ```\r\n1. Run Studio\r\n1. Navigate to a course, and then \"Settings > Advanced Settings\".\r\n1. Update the \"Advanced Module List\" field to contain `[\"vectordraw\"]`.\r\n1. Click \"Save Changes\".\r\n1. Navigate to the outline and create a new Section, Subsection, and Unit. You will be redirected to the Unit authoring view.\r\n1. Select \"Advanced > Vector Drawing\" to create a new Vector Drawing problem.\r\n1. Click \"Edit\".\r\n1. Set the \"Vectors\" field with the following block:\r\n\r\n    ```json\r\n[\r\n    {\r\n        \"name\": \"1\",\r\n        \"description\": \"Vector 1\",\r\n        \"coords\": [\r\n            [\r\n                2.6877256317689535,\r\n                1.3971119133574006\r\n            ],\r\n            [\r\n                2.6877256317689535,\r\n                4.397111913357403\r\n            ]\r\n        ],\r\n        \"type\": \"vector\",\r\n        \"render\": false,\r\n        \"length_factor\": 1,\r\n        \"length_units\": \"\",\r\n        \"base_angle\": 0,\r\n        \"style\": {\r\n            \"pointSize\": 1,\r\n            \"pointColor\": \"red\",\r\n            \"width\": 4,\r\n            \"color\": \"blue\",\r\n            \"label\": null,\r\n            \"labelColor\": \"black\"\r\n        },\r\n        \"tail\": [\r\n            2.6877256317689535,\r\n            1.3971119133574006\r\n        ],\r\n        \"tip\": [\r\n            2.6877256317689535,\r\n            4.397111913357403\r\n        ],\r\n        \"length\": 3.000000000000002,\r\n        \"angle\": 90\r\n    },\r\n    {\r\n        \"name\": \"2\",\r\n        \"description\": \"Vector 2\",\r\n        \"coords\": [\r\n            [\r\n                -1,\r\n                1\r\n            ],\r\n            [\r\n                -0.9999999999999998,\r\n                4\r\n            ]\r\n        ],\r\n        \"type\": \"vector\",\r\n        \"render\": false,\r\n        \"length_factor\": 1,\r\n        \"length_units\": \"\",\r\n        \"base_angle\": 0,\r\n        \"style\": {\r\n            \"pointSize\": 1,\r\n            \"pointColor\": \"red\",\r\n            \"width\": 4,\r\n            \"color\": \"blue\",\r\n            \"label\": null,\r\n            \"labelColor\": \"black\"\r\n        },\r\n        \"tail\": [\r\n            -1,\r\n            1\r\n        ],\r\n        \"tip\": [\r\n            -0.9999999999999998,\r\n            4\r\n        ],\r\n        \"length\": 3,\r\n        \"angle\": 90\r\n    }\r\n]\r\n    ```\r\n1. Set the \"Expected result\" field to the following block:\r\n\r\n    ```json\r\n{\r\n    \"1\": {\r\n        \"tail\": [\r\n            2.69,\r\n            1.4\r\n        ],\r\n        \"tail_tolerance\": 1,\r\n        \"tip\": [\r\n            2.69,\r\n            4.4\r\n        ],\r\n        \"tip_tolerance\": 1\r\n    },\r\n    \"2\": {\r\n        \"tail\": [\r\n            -1,\r\n            1\r\n        ],\r\n        \"tail_tolerance\": 1,\r\n        \"tip\": [\r\n            -0.9999999999999998,\r\n            4\r\n        ],\r\n        \"tip_tolerance\": 1\r\n    }\r\n}\r\n    ```\r\n1. Click \"Save\".\r\n1. Click \"Publish\".\r\n1. Launch a browser *on a mobile device* (note that the Chromium device emulator **will not work** for this test) and navigate to the Vector Drawing problem in the LMS.\r\n1. Tap and drag to create two new vectors. Observe that the browser window *does not scroll* as you slide your finger to initialize the new vector.","created_at":"2016-09-05T18:20:28Z","updated_at":"2016-09-06T04:06:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e93a043a3f5d8542e8a5e729debce7a29404bc0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12/commits","review_comments_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12/comments","review_comment_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/12/comments","statuses_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/statuses/0cda22ba55acb67b17ec4bd25feccc7c9379569f","head":{"label":"open-craft:bdero/disable-scroll-during-draw","ref":"bdero/disable-scroll-during-draw","sha":"0cda22ba55acb67b17ec4bd25feccc7c9379569f","user":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"repo":{"id":45102882,"name":"xblock-vectordraw","full_name":"open-craft/xblock-vectordraw","owner":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-craft/xblock-vectordraw","description":"An XBlock for creating vector drawing exercises","fork":false,"url":"https://api.github.com/repos/open-craft/xblock-vectordraw","forks_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/forks","keys_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/teams","hooks_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/hooks","issue_events_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/events","assignees_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/tags","blobs_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/languages","stargazers_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/stargazers","contributors_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/contributors","subscribers_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/subscribers","subscription_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/subscription","commits_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/merges","archive_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/downloads","issues_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/deployments","created_at":"2015-10-28T09:45:59Z","updated_at":"2016-09-02T12:03:50Z","pushed_at":"2016-09-05T18:20:28Z","git_url":"git://github.com/open-craft/xblock-vectordraw.git","ssh_url":"git@github.com:open-craft/xblock-vectordraw.git","clone_url":"https://github.com/open-craft/xblock-vectordraw.git","svn_url":"https://github.com/open-craft/xblock-vectordraw","homepage":null,"size":107,"stargazers_count":1,"watchers_count":1,"language":"Python","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":"master"}},"base":{"label":"open-craft:master","ref":"master","sha":"f65e4362966652fa26f869fc091df9e5d4bfa883","user":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"repo":{"id":45102882,"name":"xblock-vectordraw","full_name":"open-craft/xblock-vectordraw","owner":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-craft/xblock-vectordraw","description":"An XBlock for creating vector drawing exercises","fork":false,"url":"https://api.github.com/repos/open-craft/xblock-vectordraw","forks_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/forks","keys_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/teams","hooks_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/hooks","issue_events_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/events","assignees_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/tags","blobs_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/languages","stargazers_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/stargazers","contributors_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/contributors","subscribers_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/subscribers","subscription_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/subscription","commits_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/merges","archive_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/downloads","issues_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/xblock-vectordraw/deployments","created_at":"2015-10-28T09:45:59Z","updated_at":"2016-09-02T12:03:50Z","pushed_at":"2016-09-05T18:20:28Z","git_url":"git://github.com/open-craft/xblock-vectordraw.git","ssh_url":"git@github.com:open-craft/xblock-vectordraw.git","clone_url":"https://github.com/open-craft/xblock-vectordraw.git","svn_url":"https://github.com/open-craft/xblock-vectordraw","homepage":null,"size":107,"stargazers_count":1,"watchers_count":1,"language":"Python","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":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12"},"html":{"href":"https://github.com/open-craft/xblock-vectordraw/pull/12"},"issue":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/12"},"comments":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/open-craft/xblock-vectordraw/statuses/0cda22ba55acb67b17ec4bd25feccc7c9379569f"}}}}
{"actor":{"display_login":"pomegranited"}}