[feat](trx-frontend-http): tune SDR spectrum with ctrl-scroll
Signed-off-by: Stan Grams <sjg@haxx.space> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
@@ -2719,19 +2719,17 @@ if (spectrumCanvas) {
|
|||||||
spectrumCanvas.addEventListener("wheel", (e) => {
|
spectrumCanvas.addEventListener("wheel", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!lastSpectrumData) return;
|
if (!lastSpectrumData) return;
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
const direction = e.deltaY < 0 ? 1 : -1;
|
||||||
|
jogFreq(direction);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const rect = spectrumCanvas.getBoundingClientRect();
|
const rect = spectrumCanvas.getBoundingClientRect();
|
||||||
const cssX = e.clientX - rect.left;
|
const cssX = e.clientX - rect.left;
|
||||||
const factor = e.deltaY < 0 ? 1.25 : 1 / 1.25;
|
const factor = e.deltaY < 0 ? 1.25 : 1 / 1.25;
|
||||||
spectrumZoomAt(cssX, rect.width, lastSpectrumData, factor);
|
spectrumZoomAt(cssX, rect.width, lastSpectrumData, factor);
|
||||||
drawSpectrum(lastSpectrumData);
|
drawSpectrum(lastSpectrumData);
|
||||||
}, { passive: false });
|
}, { passive: false });
|
||||||
|
|
||||||
// Double-click → reset zoom/pan
|
|
||||||
spectrumCanvas.addEventListener("dblclick", () => {
|
|
||||||
spectrumZoom = 1;
|
|
||||||
spectrumPanFrac = 0.5;
|
|
||||||
if (lastSpectrumData) drawSpectrum(lastSpectrumData);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── BW strip edge hit-test (CSS pixels) ──────────────────────────────────────
|
// ── BW strip edge hit-test (CSS pixels) ──────────────────────────────────────
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<button id="spectrum-auto-btn" type="button">Auto</button>
|
<button id="spectrum-auto-btn" type="button">Auto</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="spectrum-hint">Scroll to zoom · Drag to pan · Double-click to reset · Drag BW edges to resize</div>
|
<div id="spectrum-hint">Scroll to zoom · Ctrl+Scroll to tune · Drag to pan · Drag BW edges to resize</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
<div class="full-row freq-row">
|
<div class="full-row freq-row">
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
<input class="status-input" id="freq" type="text" value="--" />
|
<input class="status-input" id="freq" type="text" value="--" />
|
||||||
<div class="label"><span>Frequency</span></div>
|
<div class="label"><span>Frequency</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="freq-field frequency-col" id="center-freq-field" style="display:none;">
|
<div class="freq-field frequency-col center-frequency-col" id="center-freq-field" style="display:none;">
|
||||||
<input class="status-input" id="center-freq" type="text" value="--" />
|
<input class="status-input" id="center-freq" type="text" value="--" />
|
||||||
<div class="label"><span>Central Frequency</span></div>
|
<div class="label"><span>Central Frequency</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user