Commit 20f8ee97 authored by Romain Loth's avatar Romain Loth

restore changeType via add1Elem

parent d8d77bf7
...@@ -417,7 +417,7 @@ ...@@ -417,7 +417,7 @@
</div> </div>
</div> </div>
<div id="sidebar"> <div id="sidebar">
<div id="tab-container" class='tab-container' style="display: none;"> <div id="tab-container" class='tab-container'>
<ul class='etabs'> <ul class='etabs'>
<!-- for related elements from the combined graph (eg soc => sem) --> <!-- for related elements from the combined graph (eg soc => sem) -->
......
...@@ -544,7 +544,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -544,7 +544,7 @@ TinaWebJS = function ( sigmacanvas ) {
setTimeout(function(){ setTimeout(function(){
$('.etabs a[href="#tabs1"]').trigger('click'); $('.etabs a[href="#tabs1"]').trigger('click');
},500) },500)
ChangeGraphAppearanceByAtt(true)
console.log(" ############ / changeTYPE click"); console.log(" ############ / changeTYPE click");
console.log("") console.log("")
}); });
...@@ -555,9 +555,6 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -555,9 +555,6 @@ TinaWebJS = function ( sigmacanvas ) {
changeLevel(); changeLevel();
// FIXME intention unclear
// $("#tabs1").click()
// ChangeGraphAppearanceByAtt(true) // cf. extras_explorer
console.log(" ############ / changeLEVEL click"); console.log(" ############ / changeLEVEL click");
console.log("") console.log("")
}); });
......
...@@ -63,16 +63,19 @@ function changeType() { ...@@ -63,16 +63,19 @@ function changeType() {
var prevnodes = {} var prevnodes = {}
var prevedges = {} var prevedges = {}
for(var i in TW.partialGraph._core.graph.nodesIndex) {
anode = TW.partialGraph._core.graph.nodesIndex[i]; // for all possible nodes, which ones actually in the graph atm
for(var i in TW.nodeIds) {
anode = TW.partialGraph.graph.nodes(TW.nodeIds[i]);
if(anode) { if(anode) {
prevnodes[i] = true prevnodes[i] = true
} }
} }
var links_sels = {} var links_sels = {}
for(var i in TW.partialGraph._core.graph.edgesIndex) {
anedge = TW.partialGraph._core.graph.edgesIndex[i]; for(var i in TW.edgeIds) {
anedge = TW.partialGraph.graph.edges(TW.edgeIds[i]);
if(anedge) { if(anedge) {
prevedges[i] = true; prevedges[i] = true;
if(anedge.customAttrs) { if(anedge.customAttrs) {
...@@ -93,10 +96,12 @@ function changeType() { ...@@ -93,10 +96,12 @@ function changeType() {
if(present.level) { //If level=Global, fill all {X}-component if(present.level) { //If level=Global, fill all {X}-component
for(var nid in TW.Nodes) { for(var nid in TW.Nodes) {
if(type_t1[TW.catDict[TW.Nodes[nid].type]]) if(type_t1[TW.catDict[TW.Nodes[nid].type]]) {
add1Elem(nid) add1Elem(nid)
} }
}
for(var eid in TW.Edges) { for(var eid in TW.Edges) {
if(TW.Edges[eid].categ==str_type_t1) if(TW.Edges[eid].categ==str_type_t1)
add1Elem(eid) add1Elem(eid)
} }
...@@ -269,7 +274,22 @@ function changeType() { ...@@ -269,7 +274,22 @@ function changeType() {
oppos: [] oppos: []
}) })
fa2enabled=true; TW.partialGraph.zoomTo(TW.partialGraph._core.width / 2, TW.partialGraph._core.height / 2, 0.8).draw();//.startForceAtlas2(); // REFA new sigma.js
TW.partialGraph.camera.goTo({x:0, y:0, ratio:0.5, angle: 0})
TW.partialGraph.refresh()
// recreates FA2 nodes array from new nodes
reInitFa2({
useSoftMethod: false,
callback: function() {
// when going local, it's nice to see the selected nodes rearrange
TW.partialGraph.startForceAtlas2();
setTimeout(function(){
TW.partialGraph.stopForceAtlas2();
},
fa2milliseconds)
}
})
} }
......
...@@ -546,17 +546,17 @@ else { ...@@ -546,17 +546,17 @@ else {
if(!isUndef(sels)) this.selections = sels; if(!isUndef(sels)) this.selections = sels;
if(!isUndef(oppos)) this.opposites = oppos; if(!isUndef(oppos)) this.opposites = oppos;
this.LouvainFait = false; this.LouvainFait = false;
console.log("") // console.log("")
console.log(" % % % % % % % % % % ") // console.log(" % % % % % % % % % % ")
console.log("setState type: ", type); // console.log("setState type: ", type);
console.log("bistate: "+bistate) // console.log("bistate: "+bistate)
console.log("level: "+level); // console.log("level: "+level);
console.log("selections: "); // console.log("selections: ");
console.log(sels) // console.log(sels)
console.log("selections len: "); // console.log("selections len: ");
console.log(sels.length) // console.log(sels.length)
console.log("opposites: "); // console.log("opposites: ");
console.log(oppos) // console.log(oppos)
var present = TW.partialGraph.states.slice(-1)[0]; // Last var present = TW.partialGraph.states.slice(-1)[0]; // Last
var past = TW.partialGraph.states.slice(-2)[0] // avant Last var past = TW.partialGraph.states.slice(-2)[0] // avant Last
...@@ -704,7 +704,8 @@ else { ...@@ -704,7 +704,8 @@ else {
} }
// TEST new strategy: TW.Clusters were prepared in parseCustom // should prepare the colors/clusters menu once and for all
// (previously, needed to be called after changeType/changeLevel)
changeGraphAppearanceByFacets(true) changeGraphAppearanceByFacets(true)
// set the default legend // set the default legend
......
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