fix: bug on map zoom

This commit is contained in:
2026-06-30 09:39:21 +02:00
parent edede0bc1e
commit 65c22232dd
2 changed files with 11 additions and 4 deletions
+7 -2
View File
@@ -1992,6 +1992,11 @@ export default function App() {
setLookupBusy(true); setLookupBusy(true);
try { try {
const r = await LookupCallsign(call); const r = await LookupCallsign(call);
// Discard a STALE result: the operator already moved to another call
// (clicked a new spot / typed) while this lookup was in flight. Applying it
// would clobber the current call's fields and zoom the map to the wrong
// station — the bug where replacing a call didn't re-zoom the map.
if (call !== callsignValRef.current.trim().toUpperCase()) return;
lastLookedUpRef.current = call; lastLookedUpRef.current = call;
// cty.dat carries ONLY DXCC-entity data (country / CQ / ITU zones / continent). // cty.dat carries ONLY DXCC-entity data (country / CQ / ITU zones / continent).
// A QRZ/HamQTH hit is far richer (name, QTH, grid, address, image). When the // A QRZ/HamQTH hit is far richer (name, QTH, grid, address, image). When the
@@ -2858,7 +2863,7 @@ export default function App() {
case 'flex': case 'flex':
return ( return (
<div className="h-full w-full min-h-0 rounded-lg overflow-hidden border border-border"> <div className="h-full w-full min-h-0 rounded-lg overflow-hidden border border-border">
<FlexPanel /> <FlexPanel onCWSpeed={(w) => { setWkWpm(w); WinkeyerSetSpeed(w).catch(() => {}); saveWk({ wpm: w }); }} />
</div> </div>
); );
case 'recent': case 'recent':
@@ -3913,7 +3918,7 @@ export default function App() {
backend is a FlexRadio. */} backend is a FlexRadio. */}
{catState.backend === 'flex' && ( {catState.backend === 'flex' && (
<TabsContent value="flex" className="flex-1 min-h-0 p-0"> <TabsContent value="flex" className="flex-1 min-h-0 p-0">
<FlexPanel /> <FlexPanel onCWSpeed={(w) => { setWkWpm(w); WinkeyerSetSpeed(w).catch(() => {}); saveWk({ wpm: w }); }} />
</TabsContent> </TabsContent>
)} )}
+4 -2
View File
@@ -187,7 +187,9 @@ function Card({ icon: Icon, title, accent, children }: { icon: any; title: strin
); );
} }
export function FlexPanel() { // onCWSpeed (optional): notified when the operator changes CW speed here, so the
// host can keep the WinKeyer (which actually sends the macros) in sync.
export function FlexPanel({ onCWSpeed }: { onCWSpeed?: (wpm: number) => void } = {}) {
const [st, setSt] = useState<FlexState>(ZERO); const [st, setSt] = useState<FlexState>(ZERO);
const hold = useRef<Record<string, number>>({}); const hold = useRef<Record<string, number>>({});
// Peak-hold: keep the highest reading for ~2 s so the jittery VITA-49 meters // Peak-hold: keep the highest reading for ~2 s so the jittery VITA-49 meters
@@ -355,7 +357,7 @@ export function FlexPanel() {
<div className="border-t border-border/60 pt-3 space-y-3"> <div className="border-t border-border/60 pt-3 space-y-3">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="w-16 shrink-0 text-[11px] font-bold text-muted-foreground">Speed</span> <span className="w-16 shrink-0 text-[11px] font-bold text-muted-foreground">Speed</span>
<Slider value={st.cw_speed} disabled={off} max={60} accent="#0d9488" onChange={(v) => change('cw_speed', v, () => FlexSetCWSpeed(v))} /> <Slider value={st.cw_speed} disabled={off} max={60} accent="#0d9488" onChange={(v) => { change('cw_speed', v, () => FlexSetCWSpeed(v)); onCWSpeed?.(v); }} />
<span className="w-12 text-right text-xs font-mono tabular-nums text-muted-foreground">{st.cw_speed} wpm</span> <span className="w-12 text-right text-xs font-mono tabular-nums text-muted-foreground">{st.cw_speed} wpm</span>
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">