Skip to content
Open
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
9 changes: 9 additions & 0 deletions src/plotview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,17 @@ void PlotView::setCursorSegments(int segments)
selectedSamples.maximum = selectedSamples.minimum + (segments * sampPerSeg + 0.5f);

cursors.setSegments(segments);

updateView();
emitTimeSelection();
}

void PlotView::setFFTAndZoom(int size, int zoom)
{
auto oldSamplesPerColumn = samplesPerColumn();
float oldPlotCenter = (verticalScrollBar()->value() + viewport()->height() / 2.0) / plotsHeight();
if (verticalScrollBar()->maximum() == 0)
oldPlotCenter = 0.5;

// Set new FFT size
fftSize = size;
Expand All @@ -448,6 +452,10 @@ void PlotView::setFFTAndZoom(int size, int zoom)
horizontalScrollBar()->setPageStep(100);

updateView(true, samplesPerColumn() < oldSamplesPerColumn);

// maintain the relative position of the vertical scroll bar
if (verticalScrollBar()->maximum())
verticalScrollBar()->setValue((int )(oldPlotCenter * plotsHeight() - viewport()->height() / 2.0 + 0.5f));
}

void PlotView::setPowerMin(int power)
Expand Down Expand Up @@ -604,6 +612,7 @@ void PlotView::updateView(bool reCenter, bool expanding)
}
horizontalScrollBar()->setMaximum(std::max(0, sampleToColumn(mainSampleSource->count()) - width()));
verticalScrollBar()->setMaximum(std::max(0, plotsHeight() - viewport()->height()));

if (expanding) {
updateViewRange(reCenter);
}
Expand Down