1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 00:00:06 +02:00

Bug1697: Fix selecting with Snap To in effect

This commit is contained in:
Paul Licameli 2017-07-20 22:10:40 -04:00
parent c4a1787bb9
commit 59dab5222b

View File

@ -493,12 +493,14 @@ void SelectHandle::SetUseSnap(bool use)
// Repaint to turn the snap lines on or off
mChangeHighlight = RefreshCode::RefreshAll;
if (hasSnap && IsClicked())
if (IsClicked()) {
// Readjust the moving selection end
AssignSelection(
::GetActiveProject()->GetViewInfo(),
mUseSnap ? mSnapEnd.outTime : mSnapEnd.timeSnappedTime,
nullptr);
mChangeHighlight |= RefreshCode::UpdateSelection;
}
}
bool SelectHandle::HasSnap() const
@ -631,8 +633,7 @@ UIHandle::Result SelectHandle::Click
mFreqSelMode = FREQ_SEL_INVALID;
#endif
mSelStartValid = true;
if (!(mUseSnap && mSnapStart.Snapped()))
mSelStart = value;
mSelStart = value;
AdjustSelection(pProject, viewInfo, event.m_x, mRect.x, pTrack);
break;
}
@ -727,8 +728,7 @@ UIHandle::Result SelectHandle::Click
mFreqSelMode = FREQ_SEL_INVALID;
#endif
mSelStartValid = true;
if (!(mUseSnap && mSnapStart.Snapped()))
mSelStart = value;
mSelStart = value;
break;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
case SBBottom:
@ -1178,9 +1178,9 @@ void SelectHandle::AdjustSelection
// using snap-to-time -- then we always accept the snap results)
if (mSnapStart.outCoord >= 0 &&
mSnapEnd.outCoord >= 0 &&
std::abs(mSnapStart.outCoord - mSnapEnd.outCoord) < 3 &&
!mSnapEnd.snappedTime) {
selend = origSelend;
std::abs(mSnapStart.outCoord - mSnapEnd.outCoord) < 3) {
if(!mSnapEnd.snappedTime)
selend = origSelend;
mSnapEnd.outCoord = -1;
}
}