Commit ab293893 authored by Romain Loth's avatar Romain Loth

TEST fixing changeType bugs

parent 979ab7d6
...@@ -242,21 +242,23 @@ function changeType() { ...@@ -242,21 +242,23 @@ function changeType() {
// for all possible nodes, which ones actually in the graph atm // for all possible nodes, which ones actually in the graph atm
for(var i in TW.nodeIds) { for(var i in TW.nodeIds) {
anode = TW.partialGraph.graph.nodes(TW.nodeIds[i]); let nid = TW.nodeIds[i]
let anode = TW.partialGraph.graph.nodes(nid);
if(anode) { if(anode) {
prevnodes[i] = true prevnodes[nid] = true
} }
} }
var links_sels = {} var links_sels = {}
for(var i in TW.edgeIds) { for(var i in TW.edgeIds) {
anedge = TW.partialGraph.graph.edges(TW.edgeIds[i]); let eid = TW.edgeIds[i]
let anedge = TW.partialGraph.graph.edges(eid);
if(anedge) { if(anedge) {
prevedges[i] = true; prevedges[eid] = true;
if(anedge.customAttrs) { if(anedge.customAttrs) {
if(anedge.customAttrs["grey"]==0) { if(anedge.customAttrs["grey"]==0) {
links_sels[i] = true; links_sels[eid] = true;
} }
} }
} }
...@@ -299,30 +301,28 @@ function changeType() { ...@@ -299,30 +301,28 @@ function changeType() {
var newsels = {} var newsels = {}
var sumpastcat = t0Activetypes.map(Number).reduce(function(a, b){return a+b;}) var sumpastcat = t0Activetypes.map(Number).reduce(function(a, b){return a+b;})
if(sumpastcat==1) /* change to alter comp*/ { if(sumpastcat==1) /* change to alter comp*/ {
for(var i in prevnodes) { for(var nid in prevnodes) {
s = i; let neigh = TW.Relations[str_nextState][nid]
neigh = TW.Relations[str_nextState][s]
if(neigh) { if(neigh) {
for(var j in neigh) { for(var j in neigh) {
t = neigh[j] let tid = neigh[j]
nodes_2_colour[t]=true; nodes_2_colour[tid]=true;
} }
} }
} }
for(var i in nodes_2_colour) { for(var nid in nodes_2_colour) {
s = i; let neigh = TW.Relations[t1ActivetypesKey][nid]
neigh = TW.Relations[t1ActivetypesKey][s]
if(neigh) { if(neigh) {
for(var j in neigh) { for(var j in neigh) {
t = neigh[j] let tid = neigh[j]
if(nodes_2_colour[t]) { if(nodes_2_colour[tid]) {
edges_2_colour[s+";"+t]=true; edges_2_colour[nid+";"+tid]=true;
edges_2_colour[t+";"+s]=true; edges_2_colour[tid+";"+nid]=true;
} }
} }
} }
nodes_2_colour[i] = false; nodes_2_colour[nid] = false;
} }
for(var nid in nodes_2_colour) for(var nid in nodes_2_colour)
...@@ -429,7 +429,6 @@ function changeType() { ...@@ -429,7 +429,6 @@ function changeType() {
add1Elem(eid) add1Elem(eid)
} }
// to recreate the selection in the new type graph // to recreate the selection in the new type graph
TW.instance.selNgn.MultipleSelection2({ TW.instance.selNgn.MultipleSelection2({
nodes: sels, nodes: sels,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment