{"action":"created","comment":{"url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/comments/52103306","id":52103306,"diff_hunk":"@@ -0,0 +1,45 @@\n+'use strict';\n+\n+import {Rect, Point, Size} from '../graphical-util';\n+\n+export const Grid = class {\n+    constructor(frame, cellSize, cellSpacing = 5) {\n+        if (!(frame instanceof Rect) || !(cellSize instanceof Size)) {\n+            throw new TypeError(\n+                'Grid is being passed bad types to its constructor',\n+                'util.js'\n+            );\n+        }\n+        this.frame = frame;\n+        this.cellSize = cellSize;\n+        this.cellSpacing = cellSpacing; //the spacing in between different cells\n+                                        //and in between cells and the grid edges\n+    }\n+\n+    frameForPoint(pt, minDist = 1000000000) {\n+        //returns an object containing the frame and its distance from pt\n+        let initialX = this.frame.x + this.cellSpacing;\n+        let xIncrement = this.cellSize.width + this.cellSpacing;\n+        let initialY = this.frame.y + this.cellSpacing;\n+        let yIncrement = this.cellSize.height + this.cellSpacing;\n+        let curPoint;\n+        for (let x = initialX; x < this.frame.right; x += xIncrement) {\n+            for (let y = initialY; y < this.frame.bottom; y += yIncrement) {\n+                let cent = (new Rect(x, y, this.cellSize.width, this.cellSize.height)).center;\n+                let dist =  (pt.x - cent.x) * (pt.x - cent.x) +\n+                            (pt.y - cent.y) * (pt.y - cent.y);\n+                if (dist <= minDist) {\n+                    minDist = dist;\n+                    curPoint = cent;\n+                }\n+            }\n+        }\n+        if (curPoint !== undefined) {\n+            let retFrame = new Rect(0, 0, this.cellSize.width, this.cellSize.height);","path":"public_html/script/src/grid+draggable/grid.js","position":38,"original_position":38,"commit_id":"5b61c8b04987cf33b76d2f634552201412179ad8","original_commit_id":"5b61c8b04987cf33b76d2f634552201412179ad8","user":{"login":"OinkIguana","id":6126521,"avatar_url":"https://avatars.githubusercontent.com/u/6126521?v=3","gravatar_id":"","url":"https://api.github.com/users/OinkIguana","html_url":"https://github.com/OinkIguana","followers_url":"https://api.github.com/users/OinkIguana/followers","following_url":"https://api.github.com/users/OinkIguana/following{/other_user}","gists_url":"https://api.github.com/users/OinkIguana/gists{/gist_id}","starred_url":"https://api.github.com/users/OinkIguana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OinkIguana/subscriptions","organizations_url":"https://api.github.com/users/OinkIguana/orgs","repos_url":"https://api.github.com/users/OinkIguana/repos","events_url":"https://api.github.com/users/OinkIguana/events{/privacy}","received_events_url":"https://api.github.com/users/OinkIguana/received_events","type":"User","site_admin":false},"body":"Also `const`\r\n","created_at":"2016-02-06T15:31:28Z","updated_at":"2016-02-06T15:31:28Z","html_url":"https://github.com/OinkIguana/tactical-rpg/pull/11#discussion_r52103306","pull_request_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/comments/52103306"},"html":{"href":"https://github.com/OinkIguana/tactical-rpg/pull/11#discussion_r52103306"},"pull_request":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11","id":58521576,"html_url":"https://github.com/OinkIguana/tactical-rpg/pull/11","diff_url":"https://github.com/OinkIguana/tactical-rpg/pull/11.diff","patch_url":"https://github.com/OinkIguana/tactical-rpg/pull/11.patch","issue_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/11","number":11,"state":"open","locked":false,"title":"Added grid_draggable, and finished their tests","user":{"login":"ethan-hardy","id":8059022,"avatar_url":"https://avatars.githubusercontent.com/u/8059022?v=3","gravatar_id":"","url":"https://api.github.com/users/ethan-hardy","html_url":"https://github.com/ethan-hardy","followers_url":"https://api.github.com/users/ethan-hardy/followers","following_url":"https://api.github.com/users/ethan-hardy/following{/other_user}","gists_url":"https://api.github.com/users/ethan-hardy/gists{/gist_id}","starred_url":"https://api.github.com/users/ethan-hardy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethan-hardy/subscriptions","organizations_url":"https://api.github.com/users/ethan-hardy/orgs","repos_url":"https://api.github.com/users/ethan-hardy/repos","events_url":"https://api.github.com/users/ethan-hardy/events{/privacy}","received_events_url":"https://api.github.com/users/ethan-hardy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-06T14:44:04Z","updated_at":"2016-02-06T15:31:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d402e1b9798fe71eb3e90bb62938cfea1660b30","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11/commits","review_comments_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11/comments","review_comment_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/11/comments","statuses_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/statuses/5b61c8b04987cf33b76d2f634552201412179ad8","head":{"label":"OinkIguana:drawable","ref":"drawable","sha":"5b61c8b04987cf33b76d2f634552201412179ad8","user":{"login":"OinkIguana","id":6126521,"avatar_url":"https://avatars.githubusercontent.com/u/6126521?v=3","gravatar_id":"","url":"https://api.github.com/users/OinkIguana","html_url":"https://github.com/OinkIguana","followers_url":"https://api.github.com/users/OinkIguana/followers","following_url":"https://api.github.com/users/OinkIguana/following{/other_user}","gists_url":"https://api.github.com/users/OinkIguana/gists{/gist_id}","starred_url":"https://api.github.com/users/OinkIguana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OinkIguana/subscriptions","organizations_url":"https://api.github.com/users/OinkIguana/orgs","repos_url":"https://api.github.com/users/OinkIguana/repos","events_url":"https://api.github.com/users/OinkIguana/events{/privacy}","received_events_url":"https://api.github.com/users/OinkIguana/received_events","type":"User","site_admin":false},"repo":{"id":49353850,"name":"tactical-rpg","full_name":"OinkIguana/tactical-rpg","owner":{"login":"OinkIguana","id":6126521,"avatar_url":"https://avatars.githubusercontent.com/u/6126521?v=3","gravatar_id":"","url":"https://api.github.com/users/OinkIguana","html_url":"https://github.com/OinkIguana","followers_url":"https://api.github.com/users/OinkIguana/followers","following_url":"https://api.github.com/users/OinkIguana/following{/other_user}","gists_url":"https://api.github.com/users/OinkIguana/gists{/gist_id}","starred_url":"https://api.github.com/users/OinkIguana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OinkIguana/subscriptions","organizations_url":"https://api.github.com/users/OinkIguana/orgs","repos_url":"https://api.github.com/users/OinkIguana/repos","events_url":"https://api.github.com/users/OinkIguana/events{/privacy}","received_events_url":"https://api.github.com/users/OinkIguana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OinkIguana/tactical-rpg","description":"An online multiplayer story-driven tactical role playing game","fork":false,"url":"https://api.github.com/repos/OinkIguana/tactical-rpg","forks_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/forks","keys_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/teams","hooks_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/hooks","issue_events_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/events{/number}","events_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/events","assignees_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/assignees{/user}","branches_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/branches{/branch}","tags_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/tags","blobs_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/refs{/sha}","trees_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/statuses/{sha}","languages_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/languages","stargazers_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/stargazers","contributors_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/contributors","subscribers_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/subscribers","subscription_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/subscription","commits_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/commits{/sha}","git_commits_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/commits{/sha}","comments_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/comments{/number}","issue_comment_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/comments{/number}","contents_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/contents/{+path}","compare_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/merges","archive_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/downloads","issues_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues{/number}","pulls_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls{/number}","milestones_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/milestones{/number}","notifications_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/labels{/name}","releases_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/releases{/id}","deployments_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/deployments","created_at":"2016-01-10T04:49:51Z","updated_at":"2016-01-11T23:08:53Z","pushed_at":"2016-02-06T14:44:04Z","git_url":"git://github.com/OinkIguana/tactical-rpg.git","ssh_url":"git@github.com:OinkIguana/tactical-rpg.git","clone_url":"https://github.com/OinkIguana/tactical-rpg.git","svn_url":"https://github.com/OinkIguana/tactical-rpg","homepage":"","size":4564,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"OinkIguana:master","ref":"master","sha":"ae4c4e95b92948cace4019803a952c423f3fc3b4","user":{"login":"OinkIguana","id":6126521,"avatar_url":"https://avatars.githubusercontent.com/u/6126521?v=3","gravatar_id":"","url":"https://api.github.com/users/OinkIguana","html_url":"https://github.com/OinkIguana","followers_url":"https://api.github.com/users/OinkIguana/followers","following_url":"https://api.github.com/users/OinkIguana/following{/other_user}","gists_url":"https://api.github.com/users/OinkIguana/gists{/gist_id}","starred_url":"https://api.github.com/users/OinkIguana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OinkIguana/subscriptions","organizations_url":"https://api.github.com/users/OinkIguana/orgs","repos_url":"https://api.github.com/users/OinkIguana/repos","events_url":"https://api.github.com/users/OinkIguana/events{/privacy}","received_events_url":"https://api.github.com/users/OinkIguana/received_events","type":"User","site_admin":false},"repo":{"id":49353850,"name":"tactical-rpg","full_name":"OinkIguana/tactical-rpg","owner":{"login":"OinkIguana","id":6126521,"avatar_url":"https://avatars.githubusercontent.com/u/6126521?v=3","gravatar_id":"","url":"https://api.github.com/users/OinkIguana","html_url":"https://github.com/OinkIguana","followers_url":"https://api.github.com/users/OinkIguana/followers","following_url":"https://api.github.com/users/OinkIguana/following{/other_user}","gists_url":"https://api.github.com/users/OinkIguana/gists{/gist_id}","starred_url":"https://api.github.com/users/OinkIguana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OinkIguana/subscriptions","organizations_url":"https://api.github.com/users/OinkIguana/orgs","repos_url":"https://api.github.com/users/OinkIguana/repos","events_url":"https://api.github.com/users/OinkIguana/events{/privacy}","received_events_url":"https://api.github.com/users/OinkIguana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OinkIguana/tactical-rpg","description":"An online multiplayer story-driven tactical role playing game","fork":false,"url":"https://api.github.com/repos/OinkIguana/tactical-rpg","forks_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/forks","keys_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/teams","hooks_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/hooks","issue_events_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/events{/number}","events_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/events","assignees_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/assignees{/user}","branches_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/branches{/branch}","tags_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/tags","blobs_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/refs{/sha}","trees_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/statuses/{sha}","languages_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/languages","stargazers_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/stargazers","contributors_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/contributors","subscribers_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/subscribers","subscription_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/subscription","commits_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/commits{/sha}","git_commits_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/git/commits{/sha}","comments_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/comments{/number}","issue_comment_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/comments{/number}","contents_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/contents/{+path}","compare_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/merges","archive_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/downloads","issues_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues{/number}","pulls_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls{/number}","milestones_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/milestones{/number}","notifications_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/labels{/name}","releases_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/releases{/id}","deployments_url":"https://api.github.com/repos/OinkIguana/tactical-rpg/deployments","created_at":"2016-01-10T04:49:51Z","updated_at":"2016-01-11T23:08:53Z","pushed_at":"2016-02-06T14:44:04Z","git_url":"git://github.com/OinkIguana/tactical-rpg.git","ssh_url":"git@github.com:OinkIguana/tactical-rpg.git","clone_url":"https://github.com/OinkIguana/tactical-rpg.git","svn_url":"https://github.com/OinkIguana/tactical-rpg","homepage":"","size":4564,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11"},"html":{"href":"https://github.com/OinkIguana/tactical-rpg/pull/11"},"issue":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/11"},"comments":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/OinkIguana/tactical-rpg/statuses/5b61c8b04987cf33b76d2f634552201412179ad8"}}}}