| 26 | namespace { |
| 27 | |
| 28 | double GetZoomOfSelection( const AudacityProject &project ) |
| 29 | { |
| 30 | auto &viewInfo = ViewInfo::Get( project ); |
| 31 | auto &viewport = Viewport::Get(project); |
| 32 | |
| 33 | const double lowerBound = |
| 34 | std::max(viewInfo.selectedRegion.t0(), |
| 35 | viewport.ScrollingLowerBoundTime()); |
| 36 | const double denom = |
| 37 | viewInfo.selectedRegion.t1() - lowerBound; |
| 38 | if (denom <= 0.0) |
| 39 | return viewInfo.GetZoom(); |
| 40 | |
| 41 | // LL: The "-1" is just a hack to get around an issue where zooming to |
| 42 | // selection doesn't actually get the entire selected region within the |
| 43 | // visible area. This causes a problem with scrolling at end of playback |
| 44 | // where the selected region may be scrolled off the left of the screen. |
| 45 | // I know this isn't right, but until the real rounding or 1-off issue is |
| 46 | // found, this will have to work. |
| 47 | // PRL: Did I fix this? I am not sure, so I leave the hack in place. |
| 48 | // Fixes might have resulted from commits |
| 49 | // 1b8f44d0537d987c59653b11ed75a842b48896ea and |
| 50 | // e7c7bb84a966c3b3cc4b3a9717d5f247f25e7296 |
| 51 | auto width = viewInfo.GetTracksUsableWidth(); |
| 52 | return (width - 1) / denom; |
| 53 | } |
| 54 | |
| 55 | double GetZoomOfPreset( const AudacityProject &project, int preset ) |
| 56 | { |
no test coverage detected