()
| 578 | } |
| 579 | |
| 580 | function tick() { |
| 581 | graph.numTicks++; |
| 582 | |
| 583 | for (var name in graph.data.nodes) { |
| 584 | var obj = graph.data.nodes[name]; |
| 585 | |
| 586 | obj.positionConstraints.forEach(function (c) { |
| 587 | var w = c.weight * graph.simulation.alpha(); |
| 588 | if (!isNaN(c.x)) { |
| 589 | obj.x = (c.x * w + obj.x * (1 - w)); |
| 590 | } |
| 591 | if (!isNaN(c.y)) { |
| 592 | obj.y = (c.y * w + obj.y * (1 - w)); |
| 593 | } |
| 594 | }); |
| 595 | } |
| 596 | |
| 597 | if (graph.preventCollisions) { |
| 598 | preventCollisions(); |
| 599 | } |
| 600 | |
| 601 | graph.line |
| 602 | .attr('x1', function (d) { |
| 603 | return d.source.x; |
| 604 | }) |
| 605 | .attr('y1', function (d) { |
| 606 | return d.source.y; |
| 607 | }) |
| 608 | .each(function (d) { |
| 609 | if (isIE) { |
| 610 | this.parentNode.insertBefore(this, this); |
| 611 | } |
| 612 | |
| 613 | var x = d.target.x, |
| 614 | y = d.target.y, |
| 615 | line = new geo.LineSegment(d.source.x, d.source.y, x, y); |
| 616 | |
| 617 | for (var e in d.target.edge) { |
| 618 | var ix = line.intersect(d.target.edge[e].offset(x, y)); |
| 619 | if (ix.in1 && ix.in2) { |
| 620 | x = ix.x; |
| 621 | y = ix.y; |
| 622 | break; |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | d3.select(this) |
| 627 | .attr('x2', x) |
| 628 | .attr('y2', y); |
| 629 | }); |
| 630 | |
| 631 | graph.node |
| 632 | .attr('transform', function (d) { |
| 633 | return 'translate(' + d.x + ',' + d.y + ')'; |
| 634 | }) |
| 635 | .attr("cx", function (d) { return d.x; }) |
| 636 | .attr("cy", function (d) { return d.y; }); |
| 637 | } |
nothing calls this directly
no test coverage detected