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){
// Layout options
// --------------
TWConf.fa2Available=true; // show/hide fa2Button
TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
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
......
......@@ -546,6 +546,7 @@ var SigmaUtils = function () {
if (!args) args = {}
if (!args.manual) args.manual = false
if (!args.duration) args.duration = parseInt(TW.conf.fa2Milliseconds) || 4000
if (!args.propDuration) args.propDuration = TW.conf.fa2AdaptDuration
// togglability case
if(TW.partialGraph.isForceAtlas2Running()) {
......@@ -559,8 +560,17 @@ var SigmaUtils = function () {
if (! args.manual) {
if (TW.partialGraph.graph.nNodes() < TW.conf.minNodesForAutoFA2)
return
else
setTimeout(function(){sigma_utils.ourStopFA2()},args.duration)
else {
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
......
......@@ -183,13 +183,14 @@ TW.conf = (function(TW){
// Layout options
// --------------
TWConf.fa2Available=true; // show/hide fa2Button
TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
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
......
......@@ -175,13 +175,14 @@ TW.conf = (function(TW){
// Layout options
// --------------
TWConf.fa2Available=true; // show/hide fa2Button
TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
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
......
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