From 339864a5727727a0955be85585bc52d30cf0b572 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Sun, 31 Jul 2022 14:40:20 -0400 Subject: [PATCH] Now calculating waterfall colors based on what is on the screen (with zoom). --- htdocs/openwebrx.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 7a075e9..a0848db 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -942,9 +942,15 @@ var waterfall_measure_minmax_now = false; var waterfall_measure_minmax_continuous = false; function waterfall_measure_minmax_do(what) { + // Get visible range + var range = get_visible_freq_range(); + var start = center_freq - bandwidth / 2; + // this is based on an oversampling factor of about 1,25 - var ignored = .1 * what.length; - var data = what.slice(ignored, -ignored); + range.start = Math.max(0.1, (range.start - start) / bandwidth); + range.end = Math.min(0.9, (range.end - start) / bandwidth); + + var data = what.slice(range.start * what.length, range.end * what.length); return { min: Math.min.apply(Math, data), max: Math.max.apply(Math, data)