summaryrefslogtreecommitdiff
path: root/src/client/view/graph_view.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-01-05 13:58:48 +0200
committerAlon Levy <alon@pobox.com>2015-01-05 13:58:48 +0200
commitb15db93ed00026aa78d7dedcf5688410d4a80fc5 (patch)
tree3d45b9849d118c90a905a3171ce6f5122ac6af09 /src/client/view/graph_view.js
parenta7d5b14e6daaf6d8a525a405f083c78c2c674638 (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.js7
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) {