Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoom the plotter faster with Ctrl #1250

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/news.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

NEW: Delete key clears the waterfall.
NEW: I/Q tool can save recordings in SigMF format.
NEW: Holding Ctrl speeds up mouse wheel zoom.
IMPROVED: Reduced CPU utilization of waterfall display.
CHANGED: DMG release requires macOS 12.7 or later.

Expand Down
6 changes: 4 additions & 2 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,12 +930,14 @@ void CPlotter::wheelEvent(QWheelEvent * event)
// delta is in eigths of a degree, 15 degrees is one step
int delta = m_InvertScrolling? -event->angleDelta().y() : event->angleDelta().y();
double numSteps = delta / (8.0 * 15.0);
// zoom faster when Ctrl is held
double zoomBase = (event->modifiers() & Qt::ControlModifier) ? 0.7 : 0.9;

if (m_CursorCaptured == YAXIS)
{
// Vertical zoom. Wheel down: zoom out, wheel up: zoom in
// During zoom we try to keep the point (dB or kHz) under the cursor fixed
float zoom_fac = pow(0.9, numSteps);
float zoom_fac = pow(zoomBase, numSteps);
float ratio = (float) py / (float) h;
float db_range = m_PandMaxdB - m_PandMindB;
float y_range = (float) h;
Expand All @@ -957,7 +959,7 @@ void CPlotter::wheelEvent(QWheelEvent * event)
}
else if (m_CursorCaptured == XAXIS)
{
zoomStepX(pow(0.9, numSteps), px);
zoomStepX(pow(zoomBase, numSteps), px);
}
else if (event->modifiers() & Qt::ControlModifier)
{
Expand Down