diff options
| author | Alon Levy <alon@pobox.com> | 2014-10-07 08:46:20 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-10-07 08:51:34 +0300 |
| commit | 5ffbcbb1630e0101e1be841008be53e7186bbc3a (patch) | |
| tree | 35cc6ea2623041777a00868c6abf7ac09ae67b3f | |
| parent | df93bb43321bcccbc7ee539b520203e97f18d9da (diff) | |
d3: don't divide by zero if no weight is set
| -rw-r--r-- | external/scripts/d3/d3.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/external/scripts/d3/d3.js b/external/scripts/d3/d3.js index 82287776..9956a0dc 100644 --- a/external/scripts/d3/d3.js +++ b/external/scripts/d3/d3.js @@ -6108,7 +6108,7 @@ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; x *= l; y *= l; - t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.x -= x * (k = (s.weight ? s.weight : 1) / ((t.weight ? t.weight : 1) + (s.weight ? s.weight : 1))); t.y -= y * k; s.x += x * (k = 1 - k); s.y += y * k; |
