mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Bug 1292 - Enh: Zoom Normal (Ctrl+2) may move selection off screen
Selection is now centred after any zoom, if it will fit on screen.
This commit is contained in:
parent
7a5bbbcce8
commit
eee58d9449
@ -4673,6 +4673,16 @@ void AudacityProject::Zoom(double level)
|
||||
{
|
||||
mViewInfo.SetZoom(level);
|
||||
FixScrollbars();
|
||||
// See if we can center the selection on screen, and have it actually fit.
|
||||
// tOnLeft is the amount of time we would need before the selection left edge to center it.
|
||||
float t0 = mViewInfo.selectedRegion.t0();
|
||||
float t1 = mViewInfo.selectedRegion.t1();
|
||||
float tAvailable = GetScreenEndTime() - mViewInfo.h;
|
||||
float tOnLeft = (tAvailable - t0 + t1)/2.0;
|
||||
// Bug 1292 (Enh) is effectively a request to do this scrolling of the selection into view.
|
||||
// If tOnLeft is positive, then we have room for the selection, so scroll to it.
|
||||
if( tOnLeft >=0 )
|
||||
TP_ScrollWindow( t0-tOnLeft);
|
||||
}
|
||||
|
||||
// Utility function called by other zoom methods
|
||||
|
Loading…
x
Reference in New Issue
Block a user