()
| 135728 | if (x == null) x = 0; |
| 135729 | if (y == null) y = 0; |
| 135730 | function force() { |
| 135731 | var i, n = nodes.length, node, sx = 0, sy = 0; |
| 135732 | for(i = 0; i < n; ++i)node = nodes[i], sx += node.x, sy += node.y; |
| 135733 | for(sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i)node = nodes[i], node.x -= sx, node.y -= sy; |
| 135734 | } |
| 135735 | force.initialize = function(_) { |
| 135736 | nodes = _; |
| 135737 | }; |