diff --git a/twmain/enviroment.js b/twmain/enviroment.js index 346c119f45fa49c1b493ab50a7d8fee3d25a30f1..7c7b384b4e06f7b1634d09ef32513e1760f9285d 100755 --- a/twmain/enviroment.js +++ b/twmain/enviroment.js @@ -376,7 +376,9 @@ function changeType(optionaltypeFlag) { sourceNids = TW.partialGraph.graph.nodes().map(function(n){return n.id}) } let targetNids = {} - if (!mixedState) targetNids = getNeighbors(sourceNids, 'XR') + if (!mixedState && outgoing.level) { + targetNids = getNeighbors(sourceNids, 'XR') + } else { // in mixed state we need to separate those already tgt state from others let alreadyOk = TW.partialGraph.graph.getNodesByType(typeFlag) @@ -385,7 +387,6 @@ function changeType(optionaltypeFlag) { let needTransition = [] for (var i in sourceNids) { let nid = sourceNids[i] - console.log('nid', nid) if (alreadyOkLookup[nid]) targetNids[nid] = true else needTransition.push(nid) } @@ -413,7 +414,17 @@ function changeType(optionaltypeFlag) { // 5 - define the new selection 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