From 5b360f86ea778ceae319e01b26be2f6d955990c2 Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Thu, 11 Aug 2016 22:18:46 +0200 Subject: [PATCH] Now the waterfall will not fall out of the graph area! --- htdocs/openwebrx.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 32f9bc7..81248fd 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1961,6 +1961,7 @@ function mathbox_init() mathbox_data_index = 0; //the index of the last empty line / the line to be overwritten mathbox_data = new Float32Array(fft_size * mathbox_data_max_depth); mathbox_data_global_index = 0; + mathbox_correction_for_z = 0; mathbox = mathBox({ plugins: ['core', 'controls', 'cursor', 'stats'], @@ -2011,10 +2012,15 @@ function mathbox_init() //var remap = function (v) { return Math.sqrt(.5 + .5 * v); }; + var remap = function(x,z,t) { + var zAdd; var currentTimePos = mathbox_data_global_index/(fft_fps*1.0); - zAdd = -(t-currentTimePos)/10; + zAdd = (-(t-currentTimePos)/10) - mathbox_correction_for_z; + if(zAdd<-0.2) { mathbox_correction_for_z += -zAdd; zAdd=0; } + if(zAdd>0.2) { mathbox_correction_for_z += zAdd; zAdd=0; } + var xIndex = Math.trunc(((x+1)/2.0)*fft_size); //x: frequency var zIndex = Math.trunc(z*(mathbox_data_max_depth-1)); //z: time var realZIndex = mathbox_get_data_line(zIndex);