Commit 9584e681 authored by PkSM3's avatar PkSM3

bugsfixed: IncrmtMode+Single|Multiple_Selection

parent 6919f1d1
......@@ -307,7 +307,6 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
return;
}
var filterparams = AlgorithmForSliders ( partialGraph._core.graph.nodes , type_attrb , type , criteria)
var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"]
......@@ -422,12 +421,12 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
var steps = Math.round( Math.sqrt( N ) );
var stepsize = Math.round( N / steps );
pr("-----------------------------------")
pr("number of visible nodes|edges: "+N);
// pr("-----------------------------------")
// pr("number of visible nodes|edges: "+N);
pr("number of steps : "+steps)
pr("size of one step : "+stepsize)
pr("-----------------------------------")
// pr("number of steps : "+steps)
// pr("size of one step : "+stepsize)
// pr("-----------------------------------")
var finalarray = []
......
......@@ -412,7 +412,7 @@ function theListeners(){
.mousewheel(onGraphScroll)
.mousedown(function(e){
//left click!
//left click!<- normal click
if(e.which==1){
......@@ -446,23 +446,41 @@ function theListeners(){
actualSel.push(n.id);
}
}
});
MultipleSelection(actualSel);
});
if(checkBox) {
var dummyarray = {};
for(var i in actualSel) dummyarray[ actualSel[i] ]=1;
for(var i in selections) dummyarray[ i ]=1;
var countTypes = {};
for(var i in dummyarray) {
if( isUndef(countTypes[Nodes[i].type]) )
countTypes[Nodes[i].type]=1;
else
countTypes[Nodes[i].type]++;
}
cancelSelection(false);
cpCountTypes = Object.keys(countTypes);
if(cpCountTypes.length==1) MultipleSelection(Object.keys(dummyarray));
else MultipleSelection(actualSel);
} else MultipleSelection(actualSel);
// //The most brilliant way of knowing if an array is empty in the world of JavaScript
i=0; for(var s in actualSel) { i++; break;}
if(is_empty(actualSel) || i==0){
pr("cursor radius ON, mouseDown -> selecciones vacias");
cancelSelection(false);
// $("#names").html("");
// $("#opossiteNodes").html("");
// $("#information").html("");
// $("#topPapers").html("");
// $("#tips").html(getTips());
// changeButton("unselectNodes");
// if(counter>0) graphResetColor();
//$("#names").html("");
//$("#opossiteNodes").html("");
//$("#information").html("");
//$("#topPapers").html("");
//$("#tips").html(getTips());
//changeButton("unselectNodes");
//if(counter>0) graphResetColor();
}
} else {
......@@ -610,7 +628,6 @@ function theListeners(){
}
// extractFromJson()
// Social Spatialization
// Semantic Spatialization
......
......@@ -483,18 +483,20 @@ function greyEverything(){
}
eds[i].attr['grey'] = 1;
}
for(var i in selections){
if(!isUndef(nodes1[i])){
if(!isUndef(nodes1[i]["neighbours"])){
nb=nodes1[i]["neighbours"];
for(var j in nb){
deselections[nb[j]]=1;
partialGraph._core.graph.nodesIndex[nb[j]].forceLabel=true;
partialGraph._core.graph.nodesIndex[nb[j]].neighbour=true;
}
}
}
}
// deselect neighbours of previous selection i think
// for(var i in selections){
// if(!isUndef(nodes1[i])){
// if(!isUndef(nodes1[i]["neighbours"])){
// nb=nodes1[i]["neighbours"];
// for(var j in nb){
// deselections[nb[j]]=1;
// partialGraph._core.graph.nodesIndex[nb[j]].forceLabel=true;
// partialGraph._core.graph.nodesIndex[nb[j]].neighbour=true;
// }
// }
// }
// }
}
......@@ -504,8 +506,7 @@ function markAsSelected(n_id,sel) {
if(!isUndef(n_id.id)) nodeSel=n_id;
else nodeSel = partialGraph._core.graph.nodesIndex[n_id];
if(sel==true) {
if(sel) {
nodeSel.color = nodeSel.attr['true_color'];
nodeSel.attr['grey'] = 0;
......@@ -972,8 +973,8 @@ function DrawAsSelectedNodes( nodeskeys ) {
function MultipleSelection(nodes){
pr("IN MULTIPLE SELECTION:")
pr("IN MULTIPLE SELECTION: checkbox="+checkBox)
if(!checkBox) cancelSelection(false);
greyEverything();
......@@ -991,15 +992,20 @@ function MultipleSelection(nodes){
}
checkBox=false;
} else {
//checkbox = true
//incrementing the selections[]
cancelSelection(false);
greyEverything();
for(var i in ndsids){
nodeid = ndsids[i]
getOpossitesNodes(nodeid,false); //false -> just nodeid
markAsSelected(nodeid,true);
}
for(var i in ndsids){
nodeid = ndsids[i]
getOpossitesNodes(nodeid,false); //false -> just nodeid
}
for( var i in selections){
markAsSelected(i,true);
}
}
overNodes=true;
partialGraph.draw();
......@@ -1010,6 +1016,37 @@ function MultipleSelection(nodes){
RefreshState("")
}
//test-function
function genericHighlightSelection( nodes ) {
for( var n in nodes ) {
pr(n)
}
// nodeSel.color = nodeSel.attr['true_color'];
// nodeSel.attr['grey'] = 0;
// if(swclickActual=="social") {
// if(nodeSel.type==catSoc){
// if( !isUndef(nodes1[nodeSel.id]) &&
// !isUndef(nodes1[nodeSel.id].neighbours)
// ) {
// neigh=nodes1[nodeSel.id].neighbours;/**/
// for(var i in neigh) {
// if( !isUndef(partialGraph._core.graph.nodesIndex[neigh[i]]) ) {
// nodeVec = partialGraph._core.graph.nodesIndex[neigh[i]];
// possibledge1 = partialGraph._core.graph.edgesIndex[nodeVec.id+";"+nodeSel.id]
// possibledge2 = partialGraph._core.graph.edgesIndex[nodeSel.id+";"+nodeVec.id]
// }
// }
// }
// }
// }
}
function hoverNodeEffectWhileFA2(selectionRadius) {
partialGraph.bind('downnodes', function (event) {
......@@ -1027,8 +1064,9 @@ function hoverNodeEffectWhileFA2(selectionRadius) {
if(cursor_size==0 && checkBox){
//Normal click on a node, but we won't clean the previous selections
selections[nodeID] = 1;
$.doTimeout(30,function (){
MultipleSelection(nodeID);
MultipleSelection( Object.keys(selections) );
});
// getOpossitesNodes(nodeID, false);//passing just the node-id
}
......
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