mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 09:20:16 +01:00
Bugs 2558 2559: After clip left/right, selection start can be wrong
Problem: In DoClipMove() in ClipMenus.cpp, there are a couple of problems in the code for the adjustment of the new value t0 due to potential rounding errors: 1. The code uses the start and end of intervals, and these values are not updated after the move. 2. It's assumed that the same correction is valid for all track types. Fix: Implement an adjustment which depends on track type, and does not use the start and end values of intervals.
This commit is contained in:
@@ -662,24 +662,18 @@ double DoClipMove( AudacityProject &project, Track *track,
|
||||
|
||||
auto hSlideAmount = state.DoSlideHorizontal( desiredSlideAmount );
|
||||
|
||||
// update t0 and t1. There is the possibility that the updated
|
||||
// t0 may no longer be within the clip due to rounding errors,
|
||||
// so t0 is adjusted so that it is.
|
||||
double newT0 = t0 + hSlideAmount;
|
||||
if (hitTestResult != TrackShifter::HitTestResult::Track) {
|
||||
// pShifter is still undestroyed in the ClipMoveState
|
||||
auto &intervals = pShifter->MovingIntervals();
|
||||
if ( !intervals.empty() ) {
|
||||
auto &interval = intervals[0];
|
||||
if (newT0 < interval.Start())
|
||||
newT0 = interval.Start();
|
||||
if (newT0 > interval.End())
|
||||
newT0 = interval.End();
|
||||
double diff = selectedRegion.duration();
|
||||
selectedRegion.setTimes(newT0, newT0 + diff);
|
||||
}
|
||||
// If necessary, correct for rounding errors. For example,
|
||||
// for a wavetrack, ensure that t0 is still in the clip
|
||||
// which it was within before the move.
|
||||
// (pShifter is still undestroyed in the ClipMoveState.)
|
||||
newT0 = pShifter->AdjustT0(newT0);
|
||||
}
|
||||
|
||||
double diff = selectedRegion.duration();
|
||||
selectedRegion.setTimes(newT0, newT0 + diff);
|
||||
|
||||
return hSlideAmount;
|
||||
};
|
||||
return 0.0;
|
||||
|
||||
Reference in New Issue
Block a user