MCPcopy Create free account
hub / github.com/audacity/audacity / DoScroll

Method DoScroll

libraries/lib-viewport/Viewport.cpp:440–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440void Viewport::DoScroll()
441{
442 auto &project = mProject;
443 auto &viewInfo = ViewInfo::Get( project );
444 const double lowerBound = ScrollingLowerBoundTime();
445
446 auto width = viewInfo.GetTracksUsableWidth();
447 const auto zoom = viewInfo.GetZoom();
448 viewInfo.hpos = std::clamp(sbarH / zoom, lowerBound, std::max(lowerBound, total - width / zoom));
449
450 const auto pos = mpCallbacks ? mpCallbacks->GetVerticalThumbPosition() : 0;
451 viewInfo.vpos = pos * scrollStep;
452
453 //mchinen: do not always set this project to be the active one.
454 //a project may autoscroll while playing in the background
455 //I think this is okay since OnMouseEvent has one of these.
456 //SetActiveProject(this);
457
458 if (!mAutoScrolling)
459 Publish({ true, false, false });
460}
461
462void Viewport::ZoomFitHorizontallyAndShowTrack(Track *pTrack)
463{

Callers 1

OnResampleFunction · 0.80

Calls 4

GetFunction · 0.85
maxFunction · 0.85
GetZoomMethod · 0.80

Tested by

no test coverage detected