From 3599259a25367e81e9bfc7875f6e1a21298d51f9 Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Tue, 23 May 2017 11:16:57 +0200 Subject: [PATCH] Marker is also synced with the secondary waterfall zoom --- htdocs/openwebrx.css | 2 ++ htdocs/openwebrx.js | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/openwebrx.css b/htdocs/openwebrx.css index 5307058..561b026 100644 --- a/htdocs/openwebrx.css +++ b/htdocs/openwebrx.css @@ -399,6 +399,7 @@ input[type=range]:focus::-ms-fill-upper border-style: none; image-rendering: crisp-edges; image-rendering: -webkit-optimize-contrast; + /*transition: left 200ms, width 200ms;*/ } #openwebrx-phantom-canvas @@ -831,6 +832,7 @@ img.openwebrx-mirror-img { position: absolute; pointer-events: none; + transition: width 500ms, left 500ms; } #openwebrx-secondary-demod-listbox diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 332f774..4f4d090 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -2271,7 +2271,8 @@ function secondary_demod_init_canvases() secondary_demod_current_canvas_actual_line=$(secondary_demod_canvas_container).height()-1; secondary_demod_current_canvas_index=0; secondary_demod_canvases_initialized=true; - secondary_demod_update_channel_freq_from_event(); + //secondary_demod_update_channel_freq_from_event(); + mkscale(); //so that the secondary waterfall zoom level will be initialized } function secondary_demod_canvases_update_top() @@ -2419,9 +2420,9 @@ function secondary_demod_listbox_update() secondary_demod_channel_freq=1000; function secondary_demod_update_marker() { - var width = Math.max( (secondary_bw / (if_samp_rate/2)) * $(secondary_demod_canvas_container).width(), 5); - var center_at = (secondary_demod_channel_freq / (if_samp_rate/2)) * $(secondary_demod_canvas_container).width(); - var left = center_at-width / 2; + var width = Math.max( (secondary_bw / (if_samp_rate/2)) * secondary_demod_canvas_width, 5); + var center_at = (secondary_demod_channel_freq / (if_samp_rate/2)) * secondary_demod_canvas_width + secondary_demod_canvas_left; + var left = center_at-width/2; //console.log("sdum", width, left); $("#openwebrx-digimode-select-channel").width(width).css("left",left+"px") } @@ -2487,9 +2488,12 @@ function secondary_demod_waterfall_set_zoom(low_cut, high_cut) high_cut=Math.max(Math.abs(high_cut), Math.abs(low_cut)); low_cut=0; } + secondary_demod_low_cut = low_cut; + secondary_demod_high_cut = high_cut; var shown_bw = high_cut-low_cut; - var canvas_width = $(secondary_demod_canvas_container).width() * (if_samp_rate/2)/shown_bw; - var canvas_left = -canvas_width*(low_cut/(if_samp_rate/2)); - console.log("setzoom", canvas_width, canvas_left, low_cut, high_cut); - secondary_demod_canvases.map((x)=>{$(x).css("left",canvas_left+"px").css("width",canvas_width+"px");}); + secondary_demod_canvas_width = $(secondary_demod_canvas_container).width() * (if_samp_rate/2)/shown_bw; + secondary_demod_canvas_left = -secondary_demod_canvas_width*(low_cut/(if_samp_rate/2)); + //console.log("setzoom", secondary_demod_canvas_width, secondary_demod_canvas_left, low_cut, high_cut); + secondary_demod_canvases.map((x)=>{$(x).css("left",secondary_demod_canvas_left+"px").css("width",secondary_demod_canvas_width+"px");}); + secondary_demod_update_channel_freq_from_event(); }