Commit 302d8a3d authored by Romain Loth's avatar Romain Loth

fa2 autorun duration adapts to nEdges

parent 5d716e4b
...@@ -175,13 +175,14 @@ TW.conf = (function(TW){ ...@@ -175,13 +175,14 @@ TW.conf = (function(TW){
// Layout options // Layout options
// -------------- // --------------
TWConf.fa2Available=true; // show/hide fa2Button
TWConf.disperseAvailable=true; // show/hide disperseButton TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config: // if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ? TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
TWConf.fa2Milliseconds=4000; // duration of auto-run TWConf.fa2Milliseconds=4000; // duration of auto-run
TWConf.fa2AdaptDuration=true; // duration of auto-run proportional log(nEdges)
TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run
......
...@@ -546,6 +546,7 @@ var SigmaUtils = function () { ...@@ -546,6 +546,7 @@ var SigmaUtils = function () {
if (!args) args = {} if (!args) args = {}
if (!args.manual) args.manual = false if (!args.manual) args.manual = false
if (!args.duration) args.duration = parseInt(TW.conf.fa2Milliseconds) || 4000 if (!args.duration) args.duration = parseInt(TW.conf.fa2Milliseconds) || 4000
if (!args.propDuration) args.propDuration = TW.conf.fa2AdaptDuration
// togglability case // togglability case
if(TW.partialGraph.isForceAtlas2Running()) { if(TW.partialGraph.isForceAtlas2Running()) {
...@@ -559,8 +560,17 @@ var SigmaUtils = function () { ...@@ -559,8 +560,17 @@ var SigmaUtils = function () {
if (! args.manual) { if (! args.manual) {
if (TW.partialGraph.graph.nNodes() < TW.conf.minNodesForAutoFA2) if (TW.partialGraph.graph.nNodes() < TW.conf.minNodesForAutoFA2)
return return
else else {
setTimeout(function(){sigma_utils.ourStopFA2()},args.duration) if (!args.propDuration) {
setTimeout(function(){sigma_utils.ourStopFA2()},args.duration)
}
else {
let nEds = getVisibleEdges().length
let newDur = parseInt(args.duration * Math.log(nEds) / 3)
setTimeout(function(){sigma_utils.ourStopFA2()},newDur)
console.debug("fa2 adapted duration", newDur)
}
}
} }
// hide edges during work for smaller cpu load // hide edges during work for smaller cpu load
......
...@@ -183,13 +183,14 @@ TW.conf = (function(TW){ ...@@ -183,13 +183,14 @@ TW.conf = (function(TW){
// Layout options // Layout options
// -------------- // --------------
TWConf.fa2Available=true; // show/hide fa2Button
TWConf.disperseAvailable=true; // show/hide disperseButton TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config: // if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ? TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
TWConf.fa2Milliseconds=4000; // duration of auto-run TWConf.fa2Milliseconds=4000; // duration of auto-run
TWConf.fa2AdaptDuration=true; // duration of auto-run proportional log(nEdges)
TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run
......
...@@ -175,13 +175,14 @@ TW.conf = (function(TW){ ...@@ -175,13 +175,14 @@ TW.conf = (function(TW){
// Layout options // Layout options
// -------------- // --------------
TWConf.fa2Available=true; // show/hide fa2Button
TWConf.disperseAvailable=true; // show/hide disperseButton TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config: // if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ? TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
TWConf.fa2Milliseconds=4000; // duration of auto-run TWConf.fa2Milliseconds=4000; // duration of auto-run
TWConf.fa2AdaptDuration=true; // duration of auto-run proportional log(nEdges)
TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run
......
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