router: add removeTarget

This commit is contained in:
Nils Schneider 2015-03-31 22:18:09 +02:00
parent 980187193f
commit 625e7ba880
2 changed files with 11 additions and 3 deletions

View File

@ -128,8 +128,8 @@ define(["d3"], function (d3) {
}) })
link = vis.select("g.links") link = vis.select("g.links")
.selectAll("g.link") .selectAll("g.link")
.data(links, linkId) .data(links, linkId)
var linkEnter = link.enter().append("g") var linkEnter = link.enter().append("g")
.attr("class", "link") .attr("class", "link")

View File

@ -111,7 +111,15 @@ define(function () {
saveState() 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) { self.setData = function (data) {
objects.nodes = {} objects.nodes = {}