From 68de68fd25a6608f43af5cfc3150c913ba552929 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 8 Jul 2015 18:03:19 +0200 Subject: [PATCH] forcegraph: improve dragging of nodes --- lib/forcegraph.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 3d06055..7fda8fb 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -60,6 +60,9 @@ define(["d3"], function (d3) { d3.event.sourceEvent.stopPropagation() d3.event.sourceEvent.preventDefault() draggedNode.fixed |= 2 + + draggedNode.px = draggedNode.x + draggedNode.py = draggedNode.y } function dragmove() { @@ -76,7 +79,7 @@ define(["d3"], function (d3) { if (draggedNode) { d3.event.sourceEvent.stopPropagation() d3.event.sourceEvent.preventDefault() - draggedNode.fixed &= 1 + draggedNode.fixed &= ~2 draggedNode = undefined } }