Fixed bug in Graph.prototype.merge
Was using 'graph' var instead of 'this'.. thanks to Nessia for reporting this.
This commit is contained in:
parent
15dbcf89d5
commit
3662393702
|
@ -196,7 +196,7 @@ Graph.prototype.merge = function(data)
|
||||||
{
|
{
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
data.nodes.forEach(function(n) {
|
data.nodes.forEach(function(n) {
|
||||||
nodes.push(graph.addNode(new Node(n.id, n.data)));
|
nodes.push(this.addNode(new Node(n.id, n.data)));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
data.edges.forEach(function(e) {
|
data.edges.forEach(function(e) {
|
||||||
|
@ -209,7 +209,7 @@ Graph.prototype.merge = function(data)
|
||||||
? e.type + "-" + from.id + "-" + to.id
|
? e.type + "-" + from.id + "-" + to.id
|
||||||
: e.type + "-" + to.id + "-" + from.id;
|
: e.type + "-" + to.id + "-" + from.id;
|
||||||
|
|
||||||
var edge = graph.addEdge(new Edge(id, from, to, e.data));
|
var edge = this.addEdge(new Edge(id, from, to, e.data));
|
||||||
edge.data.type = e.type;
|
edge.data.type = e.type;
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user