From 9f22515930c3f4e3a8a7a226863ec867e65eb34e Mon Sep 17 00:00:00 2001 From: kimonoki Date: Tue, 7 Aug 2018 15:28:08 +1000 Subject: [PATCH] TVB-2372 Fix time display in the slider when time selection is empty --- .../visualizers/commons/scripts/virtualBrain.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tvb/interfaces/web/templates/genshi/visualizers/commons/scripts/virtualBrain.js b/tvb/interfaces/web/templates/genshi/visualizers/commons/scripts/virtualBrain.js index 0e5258a8a..512bac5dd 100644 --- a/tvb/interfaces/web/templates/genshi/visualizers/commons/scripts/virtualBrain.js +++ b/tvb/interfaces/web/templates/genshi/visualizers/commons/scripts/virtualBrain.js @@ -581,9 +581,12 @@ function _initSliders() { $('#TimeNow').val(currentTimeValue); }, change: function () { - triggered_by_timeselection = false; + if (timeselection_interval!=0){ + triggered_by_timeselection = false; tsView.timeselection_move_fn(); triggered_by_timeselection = true; + } + }, stop: function (event, target) { sliderSel = false; @@ -1126,9 +1129,9 @@ function tick() { lastTime = timeNow; if (timeData.length > 0 && !AG_isStopped) { //syncing time with the d3 plot - if (tsView.viewer_type() === 'dualbrain') { - //add dt because the 2d will add one step after the slider changes - document.getElementById("TimeNow").value = (timeselection[0]+tsView.dt()).toFixed(2); + //add dt because the 2d will add one step after the slider changes + if (timeselection[0]>0) { + document.getElementById("TimeNow").value = (timeselection[0] + tsView.dt()).toFixed(2); } else { document.getElementById("TimeNow").value = toSignificantDigits(timeData[currentTimeValue], 2);