Skip to content

[shortcuts] Center active VFO when zooming in from keyboard#2183

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
jensenpat:aether/issue-1932-zoom-center
Apr 30, 2026
Merged

[shortcuts] Center active VFO when zooming in from keyboard#2183
ten9876 merged 1 commit into
aethersdr:mainfrom
jensenpat:aether/issue-1932-zoom-center

Conversation

@jensenpat

@jensenpat jensenpat commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

This fixes #1932 by changing command zoom-in behavior to center the panadapter on the active VFO/slice instead of only nudging the center when the VFO would fall outside the newly zoomed bandwidth.

The patch is intentionally narrow:

  • keyboard zoom-in now uses the active slice frequency as the new panadapter center
  • on-screen zoom-in now uses the active overlay/VFO frequency as the new panadapter center
  • zoom-out behavior is unchanged
  • trackpad pinch behavior is unchanged, so pinch continues to anchor around the cursor
  • memory recall/bookmark behavior is left on the existing radio-native path

Problem

Before this change, repeated zoom-in commands could gradually push the active signal toward the edge of the visible panadapter. The previous logic only adjusted the center if the active VFO would be outside the new bandwidth, and even then it used an 80% edge-preserving offset. That kept the signal visible, but did not keep it centered during repeated command zooms.

For issue #1932, the expected behavior is that command-style zoom-in keeps the active operating frequency centered so the operator can repeatedly zoom in without chasing the signal across the display.

Solution

The zoom-in paths now make command zoom deterministic:

  • MainWindow::registerShortcutActions() centers keyboard zoom-in on SliceModel::frequency()
  • SpectrumWidget centers button/menu zoom-in on the active overlay frequency

The change deliberately does not route through the broader tune centering policy or memory recall code. Memory application remains radio-native via the existing memory apply semantics, which preserves radio-supported fields such as repeater offsets and avoids replaying an incomplete local subset of memory attributes.

Validation

  • git diff --check
  • cmake --build build -j10
  • ./build/memory_recall_policy_test

Manual verification covered:

  • click and center
  • click and center (multiple slices)
  • memory recall and center
  • rapid zoom in/out
  • slice bookmark recall
  • trackpad pinch anchoring at the cursor

Closes #1932, #1866, #1722

👨🏼‍💻 Generated with OpenAI Codex (GPT-5.5 Pro 4/23) and tested by @jensenpat

@jensenpat jensenpat changed the title Center active VFO when zooming in [shortcuts] Center active VFO when zooming in from keyboard Apr 30, 2026
@jensenpat jensenpat marked this pull request as ready for review April 30, 2026 04:36
@jensenpat jensenpat requested a review from ten9876 as a code owner April 30, 2026 04:36

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, clean fix — the change is well-scoped and the logic is easy to follow.

What I checked:

  • Null safety: Both paths are already guarded — s (activeSlice) is checked at line 9753 in MainWindow.cpp, and ao (activeOverlay) has the if (ao) guard in SpectrumWidget.cpp. No new null risks introduced.
  • Scope: Only the two files listed are touched, and only the zoom-in centering logic is changed. Zoom-out and pinch paths are untouched, matching the PR description.
  • Conventions: No QSettings usage, no resource leaks, nothing outside the stated scope.
  • Correctness: Replacing the edge-biased offset logic (halfBw * 0.8) with a direct center-on-VFO is the right call for keyboard/button zoom. The old code kept the signal visible but didn't keep it centered, which is exactly the #1932 complaint.

One minor observation (not blocking): on zoom-in, if the VFO frequency is near the edge of the radio's tunable range, newCenter = s->frequency() could place the center such that newCenter ± newBw/2 extends outside the valid range. This is probably clamped downstream by applyPanRangeRequest / the radio itself, but worth confirming if you haven't already.

Thanks for the contribution, @jensenpat — this is a clean and well-tested fix.

@ten9876 ten9876 merged commit 3eb5293 into aethersdr:main Apr 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zoom IN keep driving signal outside of the visible panadapter

2 participants