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