From 625e7ba880633001c409ae20c59d146f54c42e18 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 31 Mar 2015 22:18:09 +0200 Subject: [PATCH] router: add removeTarget --- lib/forcegraph.js | 4 ++-- lib/router.js | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/forcegraph.js b/lib/forcegraph.js index ba428f6..2ef1cf4 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -128,8 +128,8 @@ define(["d3"], function (d3) { }) link = vis.select("g.links") - .selectAll("g.link") - .data(links, linkId) + .selectAll("g.link") + .data(links, linkId) var linkEnter = link.enter().append("g") .attr("class", "link") diff --git a/lib/router.js b/lib/router.js index c071a10..998a1df 100644 --- a/lib/router.js +++ b/lib/router.js @@ -111,7 +111,15 @@ define(function () { saveState() } - self.addTarget = function (d) { targets.push(d) } + self.addTarget = function (d) { + targets.push(d) + } + + self.removeTarget = function (d) { + targets = targets.filter( function (e) { + return d !== e + }) + } self.setData = function (data) { objects.nodes = {}