javascriptgraphwebglvivagraphjs

VivaGraphJS remove link


I'm using vivagraphJS for drawing linked-data with webGL. When I mouseover a node, I draw each link from this node. And when I mouseout this node, I'd like to remove those links.. So, there is my code:

function removeLink(node, graph) {
     graph.forEachLinkedNode(node.id, function(linkedNode, link) {
         graph.removeLink(link);
         // I also tried this : 
         // graph.removeLink(link.fromId, link.toId);
     });
}

And there is how to do in vivagraph How To :

 g.forEachLinkedNode('nodeId', function(linkedNode, link){
    g.removeLink(link); 
 });

My problem is that when I mouseIn a node, link are shown correctly, but when I mouseOut from this node, nothing happens... (But I'm sure that my code is correct because there is a console.log that show me what's link is when I mouseOut and the data are correct..)

Maybe there is another solution with webGL to undraw an element...


Solution

  • In fact, i call removeLink function in simpleClick on node instead of doubleClick, and it's works.