Skip to content

Commit

Permalink
If target position is NaN, do nothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed May 13, 2016
1 parent 7f0201b commit f5a9ae2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/x.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default function(x) {
strengths = new Array(n);
xz = new Array(n);
for (i = 0; i < n; ++i) {
strengths[i] = +strength(nodes[i], i, nodes);
xz[i] = +x(nodes[i], i, nodes);
strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/y.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default function(y) {
strengths = new Array(n);
yz = new Array(n);
for (i = 0; i < n; ++i) {
strengths[i] = +strength(nodes[i], i, nodes);
yz[i] = +y(nodes[i], i, nodes);
strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
}
}

Expand Down

0 comments on commit f5a9ae2

Please sign in to comment.