From b15db93ed00026aa78d7dedcf5688410d4a80fc5 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 5 Jan 2015 13:58:48 +0200 Subject: client/bubble: nicer effect - instead of moving everything, just move close nodes --- src/client/view/graph_view.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/client/view') 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) { -- cgit v1.3.1