Commit 712819e2 authored by Romain Loth's avatar Romain Loth

keep current selection when going into bipartite mode

parent dba5a3c1
...@@ -376,7 +376,9 @@ function changeType(optionaltypeFlag) { ...@@ -376,7 +376,9 @@ function changeType(optionaltypeFlag) {
sourceNids = TW.partialGraph.graph.nodes().map(function(n){return n.id}) sourceNids = TW.partialGraph.graph.nodes().map(function(n){return n.id})
} }
let targetNids = {} let targetNids = {}
if (!mixedState) targetNids = getNeighbors(sourceNids, 'XR') if (!mixedState && outgoing.level) {
targetNids = getNeighbors(sourceNids, 'XR')
}
else { else {
// in mixed state we need to separate those already tgt state from others // in mixed state we need to separate those already tgt state from others
let alreadyOk = TW.partialGraph.graph.getNodesByType(typeFlag) let alreadyOk = TW.partialGraph.graph.getNodesByType(typeFlag)
...@@ -385,7 +387,6 @@ function changeType(optionaltypeFlag) { ...@@ -385,7 +387,6 @@ function changeType(optionaltypeFlag) {
let needTransition = [] let needTransition = []
for (var i in sourceNids) { for (var i in sourceNids) {
let nid = sourceNids[i] let nid = sourceNids[i]
console.log('nid', nid)
if (alreadyOkLookup[nid]) targetNids[nid] = true if (alreadyOkLookup[nid]) targetNids[nid] = true
else needTransition.push(nid) else needTransition.push(nid)
} }
...@@ -413,7 +414,17 @@ function changeType(optionaltypeFlag) { ...@@ -413,7 +414,17 @@ function changeType(optionaltypeFlag) {
// 5 - define the new selection // 5 - define the new selection
let newselsArr = [] let newselsArr = []
if (outgoing.selectionNids.length) newselsArr = Object.keys(targetNids) if (outgoing.selectionNids.length) {
if (typeFlag != 'all') {
newselsArr = Object.keys(targetNids)
}
else {
// not extending selection to all transitive neighbors
// makes the operation stable (when clicked several times,
// we extend slower towards transitive closure)
newselsArr = outgoing.selectionNids
}
}
// 6 - effect the changes on nodes // 6 - effect the changes on nodes
......
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