Fixed Link force jiggling
This commit is contained in:
@@ -35,7 +35,6 @@ function startLinkSimulation() {
|
||||
return distanceFunction(n.source, n.target, props, norm);
|
||||
})
|
||||
// Set the parameter for the algorithm (optional).
|
||||
.strength(1);
|
||||
// Restart the simulation.
|
||||
simulation.alpha(1).restart();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function(links) {
|
||||
x = target.x + target.vx - source.x - source.vx || jiggle();
|
||||
y = target.y + target.vy - source.y - source.vy || jiggle();
|
||||
l = Math.sqrt(x * x + y * y);
|
||||
l = (l - distances[i]) / l * alpha/* * strengths[i]*/;
|
||||
l = (l - distances[i]) / l * alpha * strengths[i];
|
||||
x *= l, y *= l;
|
||||
target.vx -= x * (b = bias[i]);
|
||||
target.vy -= y * b;
|
||||
|
||||
Reference in New Issue
Block a user