{"action":"created","comment":{"url":"https://api.github.com/repos/craftyjs/Crafty/pulls/comments/55462432","id":55462432,"diff_hunk":"@@ -113,17 +114,46 @@ Crafty.domLayerObject = {\n     },\n \n     /**@\n-     * #.add\n+     * #.dirty\n      * @comp DomLayer\n-     * @sign public .add(ent)\n-     * @param ent - The entity to add\n+     * @sign public .dirty(ent)\n+     * @param ent - The entity to mark as dirty\n      *\n      * Add an entity to the list of DOM object to draw\n      */\n-    add: function add(ent) {\n+    dirty: function add(ent) {\n         this._changedObjs.push(ent);\n     },\n \n+    /**@\n+     * #.attach\n+     * @comp DomLayer\n+     * @sign public .attach(ent)\n+     * @param ent - The entity to add\n+     *\n+     * Add an entity to the layer\n+     */\n+    attach: function attach(ent) {\n+        ent._drawContext = this.context;\n+        // attach the entity's div element to the dom layer\n+        this._div.appendChild(ent._element);\n+        // set position style and entity id\n+        ent._element.style.position = \"absolute\";\n+        ent._element.id = \"ent\" + this[0];\n+    },\n+    \n+    /**@\n+     * #.detach\n+     * @comp DomLayer\n+     * @sign public .detach(ent)\n+     * @param ent - The entity to remove\n+     *\n+     * Removes an entity from the layer\n+     */\n+    detach: function detach(ent) {\n+        this._div.removeChild(ent._element);\n+    },","path":"src/graphics/dom-layer.js","position":54,"original_position":54,"commit_id":"9ea2a789875287e8de8eb6bfa746a9d4f4f0e66e","original_commit_id":"9ea2a789875287e8de8eb6bfa746a9d4f4f0e66e","user":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"body":"The `_drawContext` should be set to null, but it doesn't actually need to be flagged as dirty.  (Canvas needs that because it has to manually redraw where the entity was removed, but removing the element from the parent suffices for DOM.)","created_at":"2016-03-09T02:04:03Z","updated_at":"2016-03-09T02:04:03Z","html_url":"https://github.com/craftyjs/Crafty/pull/1017#discussion_r55462432","pull_request_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017","_links":{"self":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/comments/55462432"},"html":{"href":"https://github.com/craftyjs/Crafty/pull/1017#discussion_r55462432"},"pull_request":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017"}}},"pull_request":{"url":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017","id":61860799,"html_url":"https://github.com/craftyjs/Crafty/pull/1017","diff_url":"https://github.com/craftyjs/Crafty/pull/1017.diff","patch_url":"https://github.com/craftyjs/Crafty/pull/1017.patch","issue_url":"https://api.github.com/repos/craftyjs/Crafty/issues/1017","number":1017,"state":"open","locked":false,"title":"Refactor how components are associated with specific draw layers","user":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"body":"- Abstract out the concept of attaching and detaching from a layer into a set of methods on Renderable.\r\n- Also abstract out the concept of a renderable entity being marked as dirty.\r\n- Minimal support for creating custom layers\r\n\r\nThis is an enhanced version of #995.  AFAICT the code is now fairly solid, but there are probably some documentation changes that need to be made.","created_at":"2016-03-07T00:16:30Z","updated_at":"2016-03-09T02:04:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0bdf99bfa5ca2358d3c131d7731c77093086e404","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017/commits","review_comments_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017/comments","review_comment_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/craftyjs/Crafty/issues/1017/comments","statuses_url":"https://api.github.com/repos/craftyjs/Crafty/statuses/9ea2a789875287e8de8eb6bfa746a9d4f4f0e66e","head":{"label":"starwed:create-layers","ref":"create-layers","sha":"9ea2a789875287e8de8eb6bfa746a9d4f4f0e66e","user":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"repo":{"id":6802001,"name":"Crafty","full_name":"starwed/Crafty","owner":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/starwed/Crafty","description":"JavaScript Game Engine","fork":true,"url":"https://api.github.com/repos/starwed/Crafty","forks_url":"https://api.github.com/repos/starwed/Crafty/forks","keys_url":"https://api.github.com/repos/starwed/Crafty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starwed/Crafty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starwed/Crafty/teams","hooks_url":"https://api.github.com/repos/starwed/Crafty/hooks","issue_events_url":"https://api.github.com/repos/starwed/Crafty/issues/events{/number}","events_url":"https://api.github.com/repos/starwed/Crafty/events","assignees_url":"https://api.github.com/repos/starwed/Crafty/assignees{/user}","branches_url":"https://api.github.com/repos/starwed/Crafty/branches{/branch}","tags_url":"https://api.github.com/repos/starwed/Crafty/tags","blobs_url":"https://api.github.com/repos/starwed/Crafty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starwed/Crafty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starwed/Crafty/git/refs{/sha}","trees_url":"https://api.github.com/repos/starwed/Crafty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starwed/Crafty/statuses/{sha}","languages_url":"https://api.github.com/repos/starwed/Crafty/languages","stargazers_url":"https://api.github.com/repos/starwed/Crafty/stargazers","contributors_url":"https://api.github.com/repos/starwed/Crafty/contributors","subscribers_url":"https://api.github.com/repos/starwed/Crafty/subscribers","subscription_url":"https://api.github.com/repos/starwed/Crafty/subscription","commits_url":"https://api.github.com/repos/starwed/Crafty/commits{/sha}","git_commits_url":"https://api.github.com/repos/starwed/Crafty/git/commits{/sha}","comments_url":"https://api.github.com/repos/starwed/Crafty/comments{/number}","issue_comment_url":"https://api.github.com/repos/starwed/Crafty/issues/comments{/number}","contents_url":"https://api.github.com/repos/starwed/Crafty/contents/{+path}","compare_url":"https://api.github.com/repos/starwed/Crafty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starwed/Crafty/merges","archive_url":"https://api.github.com/repos/starwed/Crafty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starwed/Crafty/downloads","issues_url":"https://api.github.com/repos/starwed/Crafty/issues{/number}","pulls_url":"https://api.github.com/repos/starwed/Crafty/pulls{/number}","milestones_url":"https://api.github.com/repos/starwed/Crafty/milestones{/number}","notifications_url":"https://api.github.com/repos/starwed/Crafty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starwed/Crafty/labels{/name}","releases_url":"https://api.github.com/repos/starwed/Crafty/releases{/id}","deployments_url":"https://api.github.com/repos/starwed/Crafty/deployments","created_at":"2012-11-21T19:50:34Z","updated_at":"2014-04-25T21:26:04Z","pushed_at":"2016-03-07T00:15:13Z","git_url":"git://github.com/starwed/Crafty.git","ssh_url":"git@github.com:starwed/Crafty.git","clone_url":"https://github.com/starwed/Crafty.git","svn_url":"https://github.com/starwed/Crafty","homepage":"http://craftyjs.com","size":6509,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"craftyjs:develop","ref":"develop","sha":"4aaf95f5b96c7bfec3cc2cfef283b6915d554500","user":{"login":"craftyjs","id":1334729,"avatar_url":"https://avatars.githubusercontent.com/u/1334729?v=3","gravatar_id":"","url":"https://api.github.com/users/craftyjs","html_url":"https://github.com/craftyjs","followers_url":"https://api.github.com/users/craftyjs/followers","following_url":"https://api.github.com/users/craftyjs/following{/other_user}","gists_url":"https://api.github.com/users/craftyjs/gists{/gist_id}","starred_url":"https://api.github.com/users/craftyjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craftyjs/subscriptions","organizations_url":"https://api.github.com/users/craftyjs/orgs","repos_url":"https://api.github.com/users/craftyjs/repos","events_url":"https://api.github.com/users/craftyjs/events{/privacy}","received_events_url":"https://api.github.com/users/craftyjs/received_events","type":"Organization","site_admin":false},"repo":{"id":1052675,"name":"Crafty","full_name":"craftyjs/Crafty","owner":{"login":"craftyjs","id":1334729,"avatar_url":"https://avatars.githubusercontent.com/u/1334729?v=3","gravatar_id":"","url":"https://api.github.com/users/craftyjs","html_url":"https://github.com/craftyjs","followers_url":"https://api.github.com/users/craftyjs/followers","following_url":"https://api.github.com/users/craftyjs/following{/other_user}","gists_url":"https://api.github.com/users/craftyjs/gists{/gist_id}","starred_url":"https://api.github.com/users/craftyjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craftyjs/subscriptions","organizations_url":"https://api.github.com/users/craftyjs/orgs","repos_url":"https://api.github.com/users/craftyjs/repos","events_url":"https://api.github.com/users/craftyjs/events{/privacy}","received_events_url":"https://api.github.com/users/craftyjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/craftyjs/Crafty","description":"JavaScript Game Engine","fork":false,"url":"https://api.github.com/repos/craftyjs/Crafty","forks_url":"https://api.github.com/repos/craftyjs/Crafty/forks","keys_url":"https://api.github.com/repos/craftyjs/Crafty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craftyjs/Crafty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craftyjs/Crafty/teams","hooks_url":"https://api.github.com/repos/craftyjs/Crafty/hooks","issue_events_url":"https://api.github.com/repos/craftyjs/Crafty/issues/events{/number}","events_url":"https://api.github.com/repos/craftyjs/Crafty/events","assignees_url":"https://api.github.com/repos/craftyjs/Crafty/assignees{/user}","branches_url":"https://api.github.com/repos/craftyjs/Crafty/branches{/branch}","tags_url":"https://api.github.com/repos/craftyjs/Crafty/tags","blobs_url":"https://api.github.com/repos/craftyjs/Crafty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craftyjs/Crafty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craftyjs/Crafty/git/refs{/sha}","trees_url":"https://api.github.com/repos/craftyjs/Crafty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craftyjs/Crafty/statuses/{sha}","languages_url":"https://api.github.com/repos/craftyjs/Crafty/languages","stargazers_url":"https://api.github.com/repos/craftyjs/Crafty/stargazers","contributors_url":"https://api.github.com/repos/craftyjs/Crafty/contributors","subscribers_url":"https://api.github.com/repos/craftyjs/Crafty/subscribers","subscription_url":"https://api.github.com/repos/craftyjs/Crafty/subscription","commits_url":"https://api.github.com/repos/craftyjs/Crafty/commits{/sha}","git_commits_url":"https://api.github.com/repos/craftyjs/Crafty/git/commits{/sha}","comments_url":"https://api.github.com/repos/craftyjs/Crafty/comments{/number}","issue_comment_url":"https://api.github.com/repos/craftyjs/Crafty/issues/comments{/number}","contents_url":"https://api.github.com/repos/craftyjs/Crafty/contents/{+path}","compare_url":"https://api.github.com/repos/craftyjs/Crafty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craftyjs/Crafty/merges","archive_url":"https://api.github.com/repos/craftyjs/Crafty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craftyjs/Crafty/downloads","issues_url":"https://api.github.com/repos/craftyjs/Crafty/issues{/number}","pulls_url":"https://api.github.com/repos/craftyjs/Crafty/pulls{/number}","milestones_url":"https://api.github.com/repos/craftyjs/Crafty/milestones{/number}","notifications_url":"https://api.github.com/repos/craftyjs/Crafty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craftyjs/Crafty/labels{/name}","releases_url":"https://api.github.com/repos/craftyjs/Crafty/releases{/id}","deployments_url":"https://api.github.com/repos/craftyjs/Crafty/deployments","created_at":"2010-11-04T23:02:09Z","updated_at":"2016-03-08T22:13:32Z","pushed_at":"2016-03-08T09:39:16Z","git_url":"git://github.com/craftyjs/Crafty.git","ssh_url":"git@github.com:craftyjs/Crafty.git","clone_url":"https://github.com/craftyjs/Crafty.git","svn_url":"https://github.com/craftyjs/Crafty","homepage":"http://craftyjs.com","size":12141,"stargazers_count":2027,"watchers_count":2027,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":471,"mirror_url":null,"open_issues_count":61,"forks":471,"open_issues":61,"watchers":2027,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017"},"html":{"href":"https://github.com/craftyjs/Crafty/pull/1017"},"issue":{"href":"https://api.github.com/repos/craftyjs/Crafty/issues/1017"},"comments":{"href":"https://api.github.com/repos/craftyjs/Crafty/issues/1017/comments"},"review_comments":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017/comments"},"review_comment":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/1017/commits"},"statuses":{"href":"https://api.github.com/repos/craftyjs/Crafty/statuses/9ea2a789875287e8de8eb6bfa746a9d4f4f0e66e"}}}}