From f3c8a5875d9029254ac03e80b0248f90c4acbafa Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Thu, 15 Dec 2022 17:11:27 -0500 Subject: [PATCH] Fixing scroll wheel operation. --- htdocs/lib/Demodulator.js | 7 +------ htdocs/openwebrx.js | 8 +++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/lib/Demodulator.js b/htdocs/lib/Demodulator.js index 68e6b7f..79282b6 100644 --- a/htdocs/lib/Demodulator.js +++ b/htdocs/lib/Demodulator.js @@ -249,12 +249,7 @@ Demodulator.prototype.set_offset_frequency = function(to_what) { if (this.offset_frequency === to_what) { return; } - if (this.get_modulation() === 'cw') { - // For CW, move offset 800Hz below the actual carrier - this.offset_frequency = to_what - 800; - } else { - this.offset_frequency = to_what; - } + this.offset_frequency = to_what; this.set(); this.emit("frequencychange", to_what); mkenvelopes(get_visible_freq_range()); diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index f614c5a..74cc3ee 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -658,7 +658,13 @@ function canvas_mouseup(evt) { var relativeX = get_relative_x(evt); if (!canvas_drag) { - $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().set_offset_frequency(canvas_get_freq_offset(relativeX)); + var demodulator = $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator(); + var f = canvas_get_freq_offset(relativeX); + // For CW, move offset 800Hz below the actual carrier + if (demodulator.get_modulation() === 'cw') { + f = f - 800; + } + demodulator.set_offset_frequency(f); } else { canvas_end_drag();