diff options
| author | Alon Levy <alon@pobox.com> | 2015-01-05 13:58:48 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-01-05 13:58:48 +0200 |
| commit | b15db93ed00026aa78d7dedcf5688410d4a80fc5 (patch) | |
| tree | 3d45b9849d118c90a905a3171ce6f5122ac6af09 /src/client/view/graph_view.js | |
| parent | a7d5b14e6daaf6d8a525a405f083c78c2c674638 (diff) | |
client/bubble: nicer effect - instead of moving everything, just move close nodes
Diffstat (limited to 'src/client/view/graph_view.js')
| -rw-r--r-- | src/client/view/graph_view.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index 334f4624..792d2e60 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -518,10 +518,11 @@ function GraphView(spec) { var dx = d.x - cx, dy = d.y - cy, r = Math.sqrt(dx * dx + dy * dy), - a = Math.atan2(dy, dx); + a = Math.atan2(dy, dx), + new_r = r > bubble_radius * 2 ? r : r / 2 + bubble_radius; // FIXME: r == 0 (or close enough) - return {x: cx + (r + bubble_radius) * Math.cos(a), - y: cy + (r + bubble_radius) * Math.sin(a)}; + return {x: cx + new_r * Math.cos(a), + y: cy + new_r * Math.sin(a)}; } function tick(e) { |
