Cytoscape.js how to manually stop layout processing

I use cytoscape.js with a mock arbor. Is there a way to manually stop the layout rendering? In the doc, I saw the "layoutstop" event, but could not actually stop the layout.

thank

+3
source share
2 answers

This is how I worked on the problem if anyone is interested: I just put the global stop_layout var in the stableEnergy function. Ugly, but it works. Hooray!

var stop_layout = false;
layout_params = {
  name: 'arbor',
  stableEnergy: function(energy){
    var e = energy; 
    return (e.max <= 0.5) || (e.mean <= 0.3) || stop_layout;
  }
};

// Then change the stop_layout value when you want to run or stop layout processing
+1
source

layoutstop- This is an event indicating that the layout is stopped. Arbor includes an option maxSimulationTimeso you can stop the layout earlier: http://cytoscape.imtqy.com/cytoscape.js/#layouts/arbor

0
source

All Articles