Commit 6a3a0735 authored by PkSM3's avatar PkSM3

OK: alpha colors when hover

parent 5a60b0d9
......@@ -688,7 +688,10 @@ function greyEverything(){
for(var i in nds){
if(!nds[i].attr['grey']){
nds[i].attr['true_color'] = nds[i].color;
nds[i].color = greyColor;
// pr(nds[i].color)
alphacol = "rgba("+hex2rga(nds[i].color)+",0.5)";
nds[i].color = alphacol;
// nds[i].color = "rgba("+hex2rga(nds[i].color)+",0.5)"
}
nds[i].attr['grey'] = 1;
}
......@@ -734,31 +737,6 @@ function markAsSelected(n_id,sel) {
neigh=nodes1[nodeSel.id].neighbours;/**/
for(var i in neigh){
// nodeVec = partialGraph._core.graph.nodesIndex[neigh[i]];
// // vec.color = vec.attr['true_color'];
// // vec.attr['grey'] = 0;
// // pr("nodeselected: "+nodeSel.id+"\t"+nodeSel.label+"\t\t||\t\tvecino: "+vec.id+"\t"+vec.label)
// possibledge1 = partialGraph._core.graph.edgesIndex[nodeVec.id+";"+nodeSel.id]
// possibledge2 = partialGraph._core.graph.edgesIndex[nodeSel.id+";"+nodeVec.id]
// an_edge = (!isUndef(possibledge1))?possibledge1:possibledge2;
// if(!isUndef(an_edge) && !an_edge.hidden) {
// //highlight node
// nodeVec.hidden = false;
// nodeVec.color = nodeVec.attr['true_color'];
// nodeVec.attr['grey'] = 0;
// //highlight edge
// an_edge.color = an_edge.attr['true_color'];
// an_edge.attr['grey'] = 0;
// }
// if (NOW=="a" || NOW=="b" && nodeVec.color==greyColor)
// nodeVec.hidden = true
vec = partialGraph._core.graph.nodesIndex[neigh[i]];
vec.color = vec.attr['true_color'];
vec.attr['grey'] = 0;
......
......@@ -194,4 +194,47 @@ function clustersBy(daclass) {
partialGraph.refresh()
partialGraph.draw();
}
function hex2rga(sent_hex) {
result = []
hex = ( sent_hex.charAt(0) === "#" ? sent_hex.substr(1) : sent_hex );
// check if 6 letters are provided
if (hex.length === 6) {
result = calculateFull(hex);
return result;
}
else if (hex.length === 3) {
result = calculatePartial(hex);
return result;
}
}
function calculateFull(hex) {
var r = parseInt(hex.substring(0, 2), 16);
var g = parseInt(hex.substring(2, 4), 16);
var b = parseInt(hex.substring(4, 6), 16);
// set results
// pr( "r:"+r)
// pr( "g:"+g)
// pr( "b:"+b)
// pr("")
return [r,g,b];
}
// function for calculating 3 letters hex value
function calculatePartial(hex) {
var r = parseInt(hex.substring(0, 1) + hex.substring(0, 1), 16);
var g = parseInt(hex.substring(1, 2) + hex.substring(1, 2), 16);
var b = parseInt(hex.substring(2, 3) + hex.substring(2, 3), 16);
// set results
// pr( "r:"+r)
// pr( "g:"+g)
// pr( "b:"+b)
// pr("")
return [r,g,b];
}
\ No newline at end of file
......@@ -31,7 +31,7 @@ function test2 {
for f in $iter
do
filename=`echo $f | sed s/"\.\/"//g`
variable=`cat $filename | grep "edgesTF"`
variable=`cat $filename | grep "greyColor"`
if [[ "$variable" != "" ]]
then
echo $filename
......
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