From 980187193f25b85a770deb4e7875210a68546f92 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 31 Mar 2015 21:31:06 +0200 Subject: [PATCH] make eslint happy --- lib/forcegraph.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 1a87808..ba428f6 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -5,6 +5,7 @@ define(["d3"], function (d3) { var nodesDict, linksDict var zoomBehavior var force + var el function nodeName(d) { if (d.node && d.node.nodeinfo) @@ -29,6 +30,15 @@ define(["d3"], function (d3) { d.fixed &= 1 } + function animatePanzoom(translate, scale) { + zoomBehavior.scale(scale) + zoomBehavior.translate(translate) + + vis.transition().duration(500) + .attr("transform", "translate(" + translate + ") " + + "scale(" + scale + ")") + } + function panzoom() { var translate = zoomBehavior.translate() var scale = zoomBehavior.scale() @@ -56,15 +66,6 @@ define(["d3"], function (d3) { animatePanzoom(translate, scale) } - function animatePanzoom(translate, scale) { - zoomBehavior.scale(scale) - zoomBehavior.translate(translate) - - vis.transition().duration(500) - .attr("transform", "translate(" + translate + ") " + - "scale(" + scale + ")") - } - function resize() { var sidebarWidth = sidebar.getWidth() var width = el.offsetWidth - sidebarWidth @@ -91,12 +92,12 @@ define(["d3"], function (d3) { }) } - var el = document.createElement("div") + el = document.createElement("div") el.classList.add("graph") self.div = el zoomBehavior = d3.behavior.zoom() - .scaleExtent([1/3, 3]) + .scaleExtent([1 / 3, 3]) .on("zoom", panzoom) vis = d3.select(el).append("svg") @@ -232,8 +233,6 @@ define(["d3"], function (d3) { node.classed("highlight", false) link.classed("highlight", false) - var size = force.size() - animatePanzoom([sidebar.getWidth(), 0], 1) }