Rhizi / rhizi

Connective intelligence
GNU Affero General Public License v3.0
13 stars 3 forks source link

Using the filter functionality causes photos to flicker #669

Closed Garbash closed 8 years ago

Garbash commented 8 years ago

What happened:

I clicking in the filter menu on a node type - This causes the nodes of this type to be filtered, but also causes all the images present on the page: http://descartes.rhizi.net/rz/Descartes%20Med%20School to reload, causing a flickering effect

What should have happened: Node images shouldn't reload/flicker.

clemsos commented 8 years ago

Yes, there is a XHR request on each graph change, which should happen only once.

Currently, changes on the graph redraw all nodes and redraw calls the load_image function : https://github.com/Rhizi/rhizi/blob/master/client/view/graph_view.js#L867

see graph_view.js : https://github.com/Rhizi/rhizi/blob/master/client/view/graph_view.js#L930

The graph update should be splitted to init the graph once with all nodes, then listen to events and just push changes to SVG elements.

graph.on("tick", tick);

function tick() {
  // Update positions of circle elements.
  node.attr("cx", function(d) { return d.x; })
      .attr("cy", function(d) { return d.y; });
}