1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 08:29:27 +02:00

FreqWindow: Begin refactoring vertical zooming code

Signed-off-by: nyanpasu64 <nyanpasu64@tuta.io>
This commit is contained in:
nyanpasu64 2021-07-10 00:02:24 -07:00 committed by Be
parent c3290707cb
commit 37dc454463

View File

@ -753,16 +753,22 @@ void FrequencyPlotDialog::DrawPlot()
return;
}
float yRange = mYMax - mYMin;
float yTotal = yRange * ((float) vZoomSlider->GetValue() / 100.0f);
// Compute y axis ruler range, given current zoom level
float yTotal, yMax, yMin;
{
float yRange = mYMax - mYMin;
yTotal = yRange * ((float) vZoomSlider->GetValue() / 100.0f);
int sTotal = yTotal * 100;
int sRange = yRange * 100;
int sPos = vPanScroller->GetThumbPosition() + ((vPanScroller->GetThumbSize() - sTotal) / 2);
vPanScroller->SetScrollbar(sPos, sTotal, sRange, sTotal);
int sTotal = yTotal * 100;
int sRange = yRange * 100;
int sPos = vPanScroller->GetThumbPosition() + ((vPanScroller->GetThumbSize() - sTotal) / 2);
float yMax = mYMax - ((float)sPos / 100);
float yMin = yMax - yTotal;
// Set scrollbar size
vPanScroller->SetScrollbar(sPos, sTotal, sRange, sTotal);
yMax = mYMax - ((float)sPos / 100);
yMin = yMax - yTotal;
}
// Set up y axis ruler