{"action":"created","comment":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments/37210525","id":37210525,"diff_hunk":"@@ -0,0 +1,78 @@\n+//////////////////////////////////////////////////////////////////////////////\n+/**\n+ * Create a new instance of class geo.gui.svgWidget\n+ *\n+ * Due to the nature of d3 creating DOM elements as it inserts them, calls to appendChild\n+ * don't appear in this widget.\n+ *\n+ * The canvas of an svgWidget always refers to the actual svg element.\n+ * The parentCanvas can refer to another widgets svg element, dom element, or the\n+ * UI layers dom element.\n+ * See {@link geo.gui.widget#parentCanvas}.\n+ *\n+ * @class\n+ * @extends geo.gui.domWidget\n+ * @returns {geo.gui.svgWidget}\n+ *\n+ */\n+//////////////////////////////////////////////////////////////////////////////\n+geo.gui.svgWidget = function (arg) {\n+  'use strict';\n+  if (!(this instanceof geo.gui.svgWidget)) {\n+    return new geo.gui.svgWidget(arg);\n+  }\n+\n+  geo.gui.domWidget.call(this, arg);\n+\n+  var m_this = this,\n+      m_renderer = null;\n+\n+  this._init = function (arg) {\n+    var d3Parent;\n+    arg = m_this.parseArgs(arg);\n+    m_this.args = arg;","path":"src/ui/svgWidget.js","position":33,"original_position":33,"commit_id":"2e578db73901559487cd56fcbbf06ea7dd24f93b","original_commit_id":"30c6a86c3518041c7e6cd0cc8ab71bbed461603a","user":{"login":"jbeezley","id":31890,"avatar_url":"https://avatars.githubusercontent.com/u/31890?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeezley","html_url":"https://github.com/jbeezley","followers_url":"https://api.github.com/users/jbeezley/followers","following_url":"https://api.github.com/users/jbeezley/following{/other_user}","gists_url":"https://api.github.com/users/jbeezley/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeezley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeezley/subscriptions","organizations_url":"https://api.github.com/users/jbeezley/orgs","repos_url":"https://api.github.com/users/jbeezley/repos","events_url":"https://api.github.com/users/jbeezley/events{/privacy}","received_events_url":"https://api.github.com/users/jbeezley/received_events","type":"User","site_admin":false},"body":"This inherits from `widget` though.  `svgWidget` and `domWidget` are sibling classes.  You could even move the options parsing out of `_init` and put it directly in the constructor.  This is what is done in [`geo.map`](https://github.com/OpenGeoscience/geojs/blob/master/src/core/map.js#L68).  The subclasses all get the same `arg` object anyway so as long as you mutate it, the subclasses will automatically get the changes.\r\n\r\nIf I'm missing something, I don't have a huge problem with how this is done now, but I would want to save `args` as `m_this._args` instead to imply that it is a protected value.","created_at":"2015-08-17T17:05:51Z","updated_at":"2015-08-17T17:05:51Z","html_url":"https://github.com/OpenGeoscience/geojs/pull/425#discussion_r37210525","pull_request_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425","_links":{"self":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments/37210525"},"html":{"href":"https://github.com/OpenGeoscience/geojs/pull/425#discussion_r37210525"},"pull_request":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425"}}},"pull_request":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425","id":41162063,"html_url":"https://github.com/OpenGeoscience/geojs/pull/425","diff_url":"https://github.com/OpenGeoscience/geojs/pull/425.diff","patch_url":"https://github.com/OpenGeoscience/geojs/pull/425.patch","issue_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/425","number":425,"state":"open","locked":false,"title":"Widgets API","user":{"login":"danlamanna","id":608229,"avatar_url":"https://avatars.githubusercontent.com/u/608229?v=3","gravatar_id":"","url":"https://api.github.com/users/danlamanna","html_url":"https://github.com/danlamanna","followers_url":"https://api.github.com/users/danlamanna/followers","following_url":"https://api.github.com/users/danlamanna/following{/other_user}","gists_url":"https://api.github.com/users/danlamanna/gists{/gist_id}","starred_url":"https://api.github.com/users/danlamanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danlamanna/subscriptions","organizations_url":"https://api.github.com/users/danlamanna/orgs","repos_url":"https://api.github.com/users/danlamanna/repos","events_url":"https://api.github.com/users/danlamanna/events{/privacy}","received_events_url":"https://api.github.com/users/danlamanna/received_events","type":"User","site_admin":false},"body":"This is the beginning of the high level widgets API, there are a number of things in this code that need to be cleaned up - but I think this is what we're looking for from an infrastructure standpoint.\n\nThis breaks the existing legend/slider widgets until we solidify this and rewrite those to conform.\n\n### Overview\n\n* Every widget is created as a top level element within the UI Layer, which used to be impeded by the renderer\n\n* Widgets have basic positioning functionality, sticky or not, absolute positioned on a map according to viewport or GCS\n\n* Widgets can tell whether they are in the viewport or not\n\n* Widgets can be nested within each other\n\n### Example Usage\n\n    var widget = uiLayer.createWidget('dom', {\n        sticky: true,\n        positionType: 'gcs',\n        position: {\n            x: -73.7572,\n            y: 42.6525\n        }\n    });\n    \n    widget.$el.attr('id', 'sticks-to-albany-div');\n\n### Todo\n\n* Canvas/el/$el is pretty confusing\n@jbeezley - How do we feel about access to a jQuery object? In terms of convention, the UI layer canvas returns the DOM element so I suppose we should stick to that?\n\n* svgWidget needs to inherit from domWidget\n\n* svgWidget addChild\nThis needs to be implemented so that adding a child to an svgWidget correctly handles the grouping of SVG elements.\n\n* Passing arg to widget init\nI think I'm doing unnecessary variable passing - still need to look into it.\n\n* Tests, documentation, updated examples\nI think this will warrant a good amount of documentation and testing - waiting for the design decisions to settle before starting them.","created_at":"2015-07-29T19:27:32Z","updated_at":"2015-08-17T17:05:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ad8b47489cc5d811eae3e2b572e55baf47227bb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425/commits","review_comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425/comments","review_comment_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/425/comments","statuses_url":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/2e578db73901559487cd56fcbbf06ea7dd24f93b","head":{"label":"OpenGeoscience:widgets-api","ref":"widgets-api","sha":"2e578db73901559487cd56fcbbf06ea7dd24f93b","user":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"repo":{"id":12960038,"name":"geojs","full_name":"OpenGeoscience/geojs","owner":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenGeoscience/geojs","description":"High performance visualization and geospatial analysis library","fork":false,"url":"https://api.github.com/repos/OpenGeoscience/geojs","forks_url":"https://api.github.com/repos/OpenGeoscience/geojs/forks","keys_url":"https://api.github.com/repos/OpenGeoscience/geojs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenGeoscience/geojs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenGeoscience/geojs/teams","hooks_url":"https://api.github.com/repos/OpenGeoscience/geojs/hooks","issue_events_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/events{/number}","events_url":"https://api.github.com/repos/OpenGeoscience/geojs/events","assignees_url":"https://api.github.com/repos/OpenGeoscience/geojs/assignees{/user}","branches_url":"https://api.github.com/repos/OpenGeoscience/geojs/branches{/branch}","tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/tags","blobs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenGeoscience/geojs/languages","stargazers_url":"https://api.github.com/repos/OpenGeoscience/geojs/stargazers","contributors_url":"https://api.github.com/repos/OpenGeoscience/geojs/contributors","subscribers_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscribers","subscription_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscription","commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenGeoscience/geojs/contents/{+path}","compare_url":"https://api.github.com/repos/OpenGeoscience/geojs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenGeoscience/geojs/merges","archive_url":"https://api.github.com/repos/OpenGeoscience/geojs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenGeoscience/geojs/downloads","issues_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues{/number}","pulls_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenGeoscience/geojs/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenGeoscience/geojs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenGeoscience/geojs/labels{/name}","releases_url":"https://api.github.com/repos/OpenGeoscience/geojs/releases{/id}","created_at":"2013-09-19T21:39:25Z","updated_at":"2015-08-05T18:56:50Z","pushed_at":"2015-08-17T15:42:41Z","git_url":"git://github.com/OpenGeoscience/geojs.git","ssh_url":"git@github.com:OpenGeoscience/geojs.git","clone_url":"https://github.com/OpenGeoscience/geojs.git","svn_url":"https://github.com/OpenGeoscience/geojs","homepage":"","size":18935,"stargazers_count":28,"watchers_count":28,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":68,"forks":15,"open_issues":68,"watchers":28,"default_branch":"master"}},"base":{"label":"OpenGeoscience:master","ref":"master","sha":"bc4a59d81ab701f249af06f37c88cfa28daa839e","user":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"repo":{"id":12960038,"name":"geojs","full_name":"OpenGeoscience/geojs","owner":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenGeoscience/geojs","description":"High performance visualization and geospatial analysis library","fork":false,"url":"https://api.github.com/repos/OpenGeoscience/geojs","forks_url":"https://api.github.com/repos/OpenGeoscience/geojs/forks","keys_url":"https://api.github.com/repos/OpenGeoscience/geojs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenGeoscience/geojs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenGeoscience/geojs/teams","hooks_url":"https://api.github.com/repos/OpenGeoscience/geojs/hooks","issue_events_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/events{/number}","events_url":"https://api.github.com/repos/OpenGeoscience/geojs/events","assignees_url":"https://api.github.com/repos/OpenGeoscience/geojs/assignees{/user}","branches_url":"https://api.github.com/repos/OpenGeoscience/geojs/branches{/branch}","tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/tags","blobs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenGeoscience/geojs/languages","stargazers_url":"https://api.github.com/repos/OpenGeoscience/geojs/stargazers","contributors_url":"https://api.github.com/repos/OpenGeoscience/geojs/contributors","subscribers_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscribers","subscription_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscription","commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenGeoscience/geojs/contents/{+path}","compare_url":"https://api.github.com/repos/OpenGeoscience/geojs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenGeoscience/geojs/merges","archive_url":"https://api.github.com/repos/OpenGeoscience/geojs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenGeoscience/geojs/downloads","issues_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues{/number}","pulls_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenGeoscience/geojs/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenGeoscience/geojs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenGeoscience/geojs/labels{/name}","releases_url":"https://api.github.com/repos/OpenGeoscience/geojs/releases{/id}","created_at":"2013-09-19T21:39:25Z","updated_at":"2015-08-05T18:56:50Z","pushed_at":"2015-08-17T15:42:41Z","git_url":"git://github.com/OpenGeoscience/geojs.git","ssh_url":"git@github.com:OpenGeoscience/geojs.git","clone_url":"https://github.com/OpenGeoscience/geojs.git","svn_url":"https://github.com/OpenGeoscience/geojs","homepage":"","size":18935,"stargazers_count":28,"watchers_count":28,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":68,"forks":15,"open_issues":68,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425"},"html":{"href":"https://github.com/OpenGeoscience/geojs/pull/425"},"issue":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/issues/425"},"comments":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/issues/425/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/425/commits"},"statuses":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/2e578db73901559487cd56fcbbf06ea7dd24f93b"}}}}