mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 07:40:23 +02:00
Enable snapping to selection/edit cursor
Makes item snap to selection start and end points. Also makes items snap to edit cursor, which follows selection start point. Signed-off-by: akleja <storspov@gmail.com> Reference-to: https://github.com/tenacityteam/tenacity/pull/387
This commit is contained in:
parent
9d77acee72
commit
f4c288e20b
@ -77,6 +77,9 @@ void SnapManager::Reinit()
|
||||
int snapTo = settings.GetSnapTo();
|
||||
double rate = settings.GetRate();
|
||||
auto format = settings.GetSelectionFormat();
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
const double t0 = viewInfo.selectedRegion.t0();
|
||||
const double t1 = viewInfo.selectedRegion.t1();
|
||||
|
||||
// No need to reinit if these are still the same
|
||||
if (snapTo == mSnapTo && rate == mRate && format == mFormat)
|
||||
@ -105,6 +108,10 @@ void SnapManager::Reinit()
|
||||
// Add a SnapPoint at t=0
|
||||
mSnapPoints.push_back(SnapPoint{});
|
||||
|
||||
// Add SnapPoints for selection start and end
|
||||
mSnapPoints.push_back(SnapPoint{ t0 });
|
||||
if (t0 != t1) mSnapPoints.push_back(SnapPoint{ t1 });
|
||||
|
||||
// Adjust and filter the candidate points
|
||||
for (const auto &candidate : mCandidates)
|
||||
CondListAdd( candidate.t, candidate.track );
|
||||
|
Loading…
x
Reference in New Issue
Block a user