mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-06 07:09:39 +02:00
Bug 1516 - Clips: Can't drag vertically if starting position of clip overlaps clip in target track
This commit is contained in:
parent
f3dcccb144
commit
4d43d2273b
@ -2372,11 +2372,12 @@ bool WaveTrack::CanOffsetClip(WaveClip* clip, double amount,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaveTrack::CanInsertClip(WaveClip* clip)
|
bool WaveTrack::CanInsertClip(WaveClip* clip, double slideBy)
|
||||||
{
|
{
|
||||||
for (const auto &c : mClips)
|
for (const auto &c : mClips)
|
||||||
{
|
{
|
||||||
if (c->GetStartTime() < clip->GetEndTime() && c->GetEndTime() > clip->GetStartTime())
|
if (c->GetStartTime() < (clip->GetEndTime()+slideBy) &&
|
||||||
|
c->GetEndTime() > (clip->GetStartTime()+slideBy))
|
||||||
return false; // clips overlap
|
return false; // clips overlap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
|
|||||||
// Before moving a clip into a track (or inserting a clip), use this
|
// Before moving a clip into a track (or inserting a clip), use this
|
||||||
// function to see if the times are valid (i.e. don't overlap with
|
// function to see if the times are valid (i.e. don't overlap with
|
||||||
// existing clips).
|
// existing clips).
|
||||||
bool CanInsertClip(WaveClip* clip);
|
bool CanInsertClip(WaveClip* clip, double slideBy=0.0);
|
||||||
|
|
||||||
// Remove the clip from the track and return a SMART pointer to it.
|
// Remove the clip from the track and return a SMART pointer to it.
|
||||||
// You assume responsibility for its memory!
|
// You assume responsibility for its memory!
|
||||||
|
@ -712,7 +712,7 @@ UIHandle::Result TimeShiftHandle::Drag
|
|||||||
TrackClip &trackClip = mClipMoveState.capturedClipArray[ii];
|
TrackClip &trackClip = mClipMoveState.capturedClipArray[ii];
|
||||||
WaveClip *const pSrcClip = trackClip.clip;
|
WaveClip *const pSrcClip = trackClip.clip;
|
||||||
if (pSrcClip)
|
if (pSrcClip)
|
||||||
ok = trackClip.dstTrack->CanInsertClip(pSrcClip);
|
ok = trackClip.dstTrack->CanInsertClip(pSrcClip, desiredSlideAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user