web: fix filter passband position on click and VFO wheel tuning

Click on spectrum/waterfall no longer sets localCenter immediately.
The filter passband now appears exactly at the clicked pixel instead of
jumping to screen center. Server's center_hz (arrives ~200ms later)
naturally re-centers the display once fresh spectrum data is ready.

VFO display wheel (vDispA/vDispB) now updates localCenter when tuning
the active VFO. Previously localCenter lagged behind, causing applyState
to teleport the filter back to center every 200ms (the "passes through
center" oscillation).

Spectrum canvas wheel (doWheel) is unchanged: user expects the spectrum
to scroll when wheel-scrolling over it, filter stays at center — correct.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 15:12:52 +03:00
co-authored by Claude Sonnet 4.6
parent 154b6eccba
commit 0e738e1967
+5 -4
View File
@@ -313,9 +313,9 @@ begin
'const nf=cl(f,30000,60000000);setHz(nf);renderVfos();onSend(nf);' +
'});}' +
'bindVfo("vDispA",()=>vfoA,v=>{vfoA=v;},()=>stA,v=>{stA=v;},()=>stAmem,v=>{stAmem=v;},' +
'function(nf){renderVfos();pend("freq");if(activeVfo==="A")ws2({cmd:"freq",hz:nf});else ws2({cmd:"freq_b",hz:nf});});' +
'function(nf){renderVfos();pend("freq");if(activeVfo==="A"){localCenter=nf;ws2({cmd:"freq",hz:nf});}else ws2({cmd:"freq_b",hz:nf});});' +
'bindVfo("vDispB",()=>vfoB,v=>{vfoB=v;},()=>stB,v=>{stB=v;},()=>stBmem,v=>{stBmem=v;},' +
'function(nf){renderVfos();pend("freq");if(activeVfo==="B")ws2({cmd:"freq",hz:nf});else ws2({cmd:"freq_b",hz:nf});});' +
'function(nf){renderVfos();pend("freq");if(activeVfo==="B"){localCenter=nf;ws2({cmd:"freq",hz:nf});}else ws2({cmd:"freq_b",hz:nf});});' +
'function selVfo(w){' +
'activeVfo=w;' +
@@ -530,9 +530,10 @@ begin
'cv.style.cursor="";' +
'if(e.button===2)return;' +
'if(dragging&&Math.abs(e.offsetX-dragX0)<4){' +
// клик — настраиваем на кликнутую частоту мгновенно
// клик — не трогаем localCenter: фильтр встаёт точно туда куда кликнули.
// Спектр остаётся на месте, сервер пришлёт center_hz через ~200ms и всё перецентрируется.
'const nf=cl(Math.round(xToHz(e.offsetX,cv.clientWidth)/100)*100,30000,60000000);' +
'setActiveVfoHz(nf);localCenter=nf;' +
'setActiveVfoHz(nf);' +
'if(activeVfo==="A")cur.vfo_a_hz=nf;else cur.vfo_b_hz=nf;' +
'renderVfos();pend("freq");ws2({cmd:"freq",hz:nf});' +
'}' +