{"action":"created","comment":{"url":"https://api.github.com/repos/almende/vis/pulls/comments/38186508","id":38186508,"diff_hunk":"@@ -1,12 +1,30 @@\n+'use strict'\n+\n+var util = require('../../../../util');\n+\n class CentralGravitySolver {\n-  constructor(body, physicsBody, options) {\n+  constructor(body, physicsBody, options, groups) {\n     this.body = body;\n     this.physicsBody = physicsBody;\n+    this.groups = groups;\n+    this.gravityGroups = {};\n     this.setOptions(options);\n   }\n \n   setOptions(options) {\n     this.options = options;\n+\n+    // Iterates through the groups and looks for the ones defining 'groupCentralGravity'\n+    if (this.groups != null) {\n+      self = this;\n+      util.forEach(this.groups.groups, function(groupDefinition, groupName) {\n+        let gravityStrength = parseInt(groupDefinition.groupGravityStrength);","path":"lib/network/modules/components/physics/CentralGravitySolver.js","position":22,"original_position":22,"commit_id":"18e0ac2dda1f06d2c58818017f1cdcb07097194a","original_commit_id":"18e0ac2dda1f06d2c58818017f1cdcb07097194a","user":{"login":"AlexDM0","id":5363277,"avatar_url":"https://avatars.githubusercontent.com/u/5363277?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexDM0","html_url":"https://github.com/AlexDM0","followers_url":"https://api.github.com/users/AlexDM0/followers","following_url":"https://api.github.com/users/AlexDM0/following{/other_user}","gists_url":"https://api.github.com/users/AlexDM0/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexDM0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexDM0/subscriptions","organizations_url":"https://api.github.com/users/AlexDM0/orgs","repos_url":"https://api.github.com/users/AlexDM0/repos","events_url":"https://api.github.com/users/AlexDM0/events{/privacy}","received_events_url":"https://api.github.com/users/AlexDM0/received_events","type":"User","site_admin":false},"body":"this should not be an int but a float","created_at":"2015-08-28T10:06:37Z","updated_at":"2015-08-28T10:06:37Z","html_url":"https://github.com/almende/vis/pull/1240#discussion_r38186508","pull_request_url":"https://api.github.com/repos/almende/vis/pulls/1240","_links":{"self":{"href":"https://api.github.com/repos/almende/vis/pulls/comments/38186508"},"html":{"href":"https://github.com/almende/vis/pull/1240#discussion_r38186508"},"pull_request":{"href":"https://api.github.com/repos/almende/vis/pulls/1240"}}},"pull_request":{"url":"https://api.github.com/repos/almende/vis/pulls/1240","id":43580806,"html_url":"https://github.com/almende/vis/pull/1240","diff_url":"https://github.com/almende/vis/pull/1240.diff","patch_url":"https://github.com/almende/vis/pull/1240.patch","issue_url":"https://api.github.com/repos/almende/vis/issues/1240","number":1240,"state":"open","locked":false,"title":"Allow groups to gather nodes around respective gravity centers.","user":{"login":"glampr","id":470610,"avatar_url":"https://avatars.githubusercontent.com/u/470610?v=3","gravatar_id":"","url":"https://api.github.com/users/glampr","html_url":"https://github.com/glampr","followers_url":"https://api.github.com/users/glampr/followers","following_url":"https://api.github.com/users/glampr/following{/other_user}","gists_url":"https://api.github.com/users/glampr/gists{/gist_id}","starred_url":"https://api.github.com/users/glampr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glampr/subscriptions","organizations_url":"https://api.github.com/users/glampr/orgs","repos_url":"https://api.github.com/users/glampr/repos","events_url":"https://api.github.com/users/glampr/events{/privacy}","received_events_url":"https://api.github.com/users/glampr/received_events","type":"User","site_admin":false},"body":"I use the option 'groupGravityStrength' (which is an Int) to set if a group should gather its nodes around it.\r\n```javascript\r\nvar network = new vis.Network(container, data, {\r\n  ....\r\n  groups: {\r\n    people: {\r\n      color: 'blue',\r\n      groupGravityStrength: 2,\r\n    },\r\n    companies: {\r\n      color: 'red',\r\n      groupGravityStrength: 2.5,\r\n    }\r\n  },\r\n  ...\r\n});\r\n```","created_at":"2015-08-27T23:58:34Z","updated_at":"2015-08-28T10:06:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3ee9d7a79230916c301ac037f3f422b246d73b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/almende/vis/pulls/1240/commits","review_comments_url":"https://api.github.com/repos/almende/vis/pulls/1240/comments","review_comment_url":"https://api.github.com/repos/almende/vis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/almende/vis/issues/1240/comments","statuses_url":"https://api.github.com/repos/almende/vis/statuses/18e0ac2dda1f06d2c58818017f1cdcb07097194a","head":{"label":"glampr:master","ref":"master","sha":"18e0ac2dda1f06d2c58818017f1cdcb07097194a","user":{"login":"glampr","id":470610,"avatar_url":"https://avatars.githubusercontent.com/u/470610?v=3","gravatar_id":"","url":"https://api.github.com/users/glampr","html_url":"https://github.com/glampr","followers_url":"https://api.github.com/users/glampr/followers","following_url":"https://api.github.com/users/glampr/following{/other_user}","gists_url":"https://api.github.com/users/glampr/gists{/gist_id}","starred_url":"https://api.github.com/users/glampr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glampr/subscriptions","organizations_url":"https://api.github.com/users/glampr/orgs","repos_url":"https://api.github.com/users/glampr/repos","events_url":"https://api.github.com/users/glampr/events{/privacy}","received_events_url":"https://api.github.com/users/glampr/received_events","type":"User","site_admin":false},"repo":{"id":41499757,"name":"vis","full_name":"glampr/vis","owner":{"login":"glampr","id":470610,"avatar_url":"https://avatars.githubusercontent.com/u/470610?v=3","gravatar_id":"","url":"https://api.github.com/users/glampr","html_url":"https://github.com/glampr","followers_url":"https://api.github.com/users/glampr/followers","following_url":"https://api.github.com/users/glampr/following{/other_user}","gists_url":"https://api.github.com/users/glampr/gists{/gist_id}","starred_url":"https://api.github.com/users/glampr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glampr/subscriptions","organizations_url":"https://api.github.com/users/glampr/orgs","repos_url":"https://api.github.com/users/glampr/repos","events_url":"https://api.github.com/users/glampr/events{/privacy}","received_events_url":"https://api.github.com/users/glampr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glampr/vis","description":"Dynamic, browser-based visualization library","fork":true,"url":"https://api.github.com/repos/glampr/vis","forks_url":"https://api.github.com/repos/glampr/vis/forks","keys_url":"https://api.github.com/repos/glampr/vis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glampr/vis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glampr/vis/teams","hooks_url":"https://api.github.com/repos/glampr/vis/hooks","issue_events_url":"https://api.github.com/repos/glampr/vis/issues/events{/number}","events_url":"https://api.github.com/repos/glampr/vis/events","assignees_url":"https://api.github.com/repos/glampr/vis/assignees{/user}","branches_url":"https://api.github.com/repos/glampr/vis/branches{/branch}","tags_url":"https://api.github.com/repos/glampr/vis/tags","blobs_url":"https://api.github.com/repos/glampr/vis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glampr/vis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glampr/vis/git/refs{/sha}","trees_url":"https://api.github.com/repos/glampr/vis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glampr/vis/statuses/{sha}","languages_url":"https://api.github.com/repos/glampr/vis/languages","stargazers_url":"https://api.github.com/repos/glampr/vis/stargazers","contributors_url":"https://api.github.com/repos/glampr/vis/contributors","subscribers_url":"https://api.github.com/repos/glampr/vis/subscribers","subscription_url":"https://api.github.com/repos/glampr/vis/subscription","commits_url":"https://api.github.com/repos/glampr/vis/commits{/sha}","git_commits_url":"https://api.github.com/repos/glampr/vis/git/commits{/sha}","comments_url":"https://api.github.com/repos/glampr/vis/comments{/number}","issue_comment_url":"https://api.github.com/repos/glampr/vis/issues/comments{/number}","contents_url":"https://api.github.com/repos/glampr/vis/contents/{+path}","compare_url":"https://api.github.com/repos/glampr/vis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glampr/vis/merges","archive_url":"https://api.github.com/repos/glampr/vis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glampr/vis/downloads","issues_url":"https://api.github.com/repos/glampr/vis/issues{/number}","pulls_url":"https://api.github.com/repos/glampr/vis/pulls{/number}","milestones_url":"https://api.github.com/repos/glampr/vis/milestones{/number}","notifications_url":"https://api.github.com/repos/glampr/vis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glampr/vis/labels{/name}","releases_url":"https://api.github.com/repos/glampr/vis/releases{/id}","created_at":"2015-08-27T16:57:07Z","updated_at":"2015-08-27T16:57:08Z","pushed_at":"2015-08-27T23:50:11Z","git_url":"git://github.com/glampr/vis.git","ssh_url":"git@github.com:glampr/vis.git","clone_url":"https://github.com/glampr/vis.git","svn_url":"https://github.com/glampr/vis","homepage":"http://visjs.org","size":108914,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"almende:master","ref":"master","sha":"955dd25caa276560513c96178a3aad5d313952c6","user":{"login":"almende","id":1436571,"avatar_url":"https://avatars.githubusercontent.com/u/1436571?v=3","gravatar_id":"","url":"https://api.github.com/users/almende","html_url":"https://github.com/almende","followers_url":"https://api.github.com/users/almende/followers","following_url":"https://api.github.com/users/almende/following{/other_user}","gists_url":"https://api.github.com/users/almende/gists{/gist_id}","starred_url":"https://api.github.com/users/almende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almende/subscriptions","organizations_url":"https://api.github.com/users/almende/orgs","repos_url":"https://api.github.com/users/almende/repos","events_url":"https://api.github.com/users/almende/events{/privacy}","received_events_url":"https://api.github.com/users/almende/received_events","type":"Organization","site_admin":false},"repo":{"id":9467421,"name":"vis","full_name":"almende/vis","owner":{"login":"almende","id":1436571,"avatar_url":"https://avatars.githubusercontent.com/u/1436571?v=3","gravatar_id":"","url":"https://api.github.com/users/almende","html_url":"https://github.com/almende","followers_url":"https://api.github.com/users/almende/followers","following_url":"https://api.github.com/users/almende/following{/other_user}","gists_url":"https://api.github.com/users/almende/gists{/gist_id}","starred_url":"https://api.github.com/users/almende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almende/subscriptions","organizations_url":"https://api.github.com/users/almende/orgs","repos_url":"https://api.github.com/users/almende/repos","events_url":"https://api.github.com/users/almende/events{/privacy}","received_events_url":"https://api.github.com/users/almende/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/almende/vis","description":"Dynamic, browser-based visualization library","fork":false,"url":"https://api.github.com/repos/almende/vis","forks_url":"https://api.github.com/repos/almende/vis/forks","keys_url":"https://api.github.com/repos/almende/vis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/almende/vis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/almende/vis/teams","hooks_url":"https://api.github.com/repos/almende/vis/hooks","issue_events_url":"https://api.github.com/repos/almende/vis/issues/events{/number}","events_url":"https://api.github.com/repos/almende/vis/events","assignees_url":"https://api.github.com/repos/almende/vis/assignees{/user}","branches_url":"https://api.github.com/repos/almende/vis/branches{/branch}","tags_url":"https://api.github.com/repos/almende/vis/tags","blobs_url":"https://api.github.com/repos/almende/vis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/almende/vis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/almende/vis/git/refs{/sha}","trees_url":"https://api.github.com/repos/almende/vis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/almende/vis/statuses/{sha}","languages_url":"https://api.github.com/repos/almende/vis/languages","stargazers_url":"https://api.github.com/repos/almende/vis/stargazers","contributors_url":"https://api.github.com/repos/almende/vis/contributors","subscribers_url":"https://api.github.com/repos/almende/vis/subscribers","subscription_url":"https://api.github.com/repos/almende/vis/subscription","commits_url":"https://api.github.com/repos/almende/vis/commits{/sha}","git_commits_url":"https://api.github.com/repos/almende/vis/git/commits{/sha}","comments_url":"https://api.github.com/repos/almende/vis/comments{/number}","issue_comment_url":"https://api.github.com/repos/almende/vis/issues/comments{/number}","contents_url":"https://api.github.com/repos/almende/vis/contents/{+path}","compare_url":"https://api.github.com/repos/almende/vis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/almende/vis/merges","archive_url":"https://api.github.com/repos/almende/vis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/almende/vis/downloads","issues_url":"https://api.github.com/repos/almende/vis/issues{/number}","pulls_url":"https://api.github.com/repos/almende/vis/pulls{/number}","milestones_url":"https://api.github.com/repos/almende/vis/milestones{/number}","notifications_url":"https://api.github.com/repos/almende/vis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/almende/vis/labels{/name}","releases_url":"https://api.github.com/repos/almende/vis/releases{/id}","created_at":"2013-04-16T08:01:02Z","updated_at":"2015-08-28T08:54:07Z","pushed_at":"2015-08-28T09:55:11Z","git_url":"git://github.com/almende/vis.git","ssh_url":"git@github.com:almende/vis.git","clone_url":"https://github.com/almende/vis.git","svn_url":"https://github.com/almende/vis","homepage":"http://visjs.org","size":108914,"stargazers_count":3019,"watchers_count":3019,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":400,"mirror_url":null,"open_issues_count":134,"forks":400,"open_issues":134,"watchers":3019,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/almende/vis/pulls/1240"},"html":{"href":"https://github.com/almende/vis/pull/1240"},"issue":{"href":"https://api.github.com/repos/almende/vis/issues/1240"},"comments":{"href":"https://api.github.com/repos/almende/vis/issues/1240/comments"},"review_comments":{"href":"https://api.github.com/repos/almende/vis/pulls/1240/comments"},"review_comment":{"href":"https://api.github.com/repos/almende/vis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/almende/vis/pulls/1240/commits"},"statuses":{"href":"https://api.github.com/repos/almende/vis/statuses/18e0ac2dda1f06d2c58818017f1cdcb07097194a"}}}}