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

Reimplement the narrowed hot zone for vertical ruler...

... Don't define the TrackPanelCell to be narrower.  Instead, change its
hit-test routine, and only if it is a Wave track.

Previous implementation had the unintended consequence, that a click in the
area excluded from vertical zooming was treated as a click on the background
outside of all tracks, causing de-selection of all tracks.
This commit is contained in:
Paul Licameli 2017-12-20 22:51:22 -05:00
parent a7960864dd
commit 095ee9185f
2 changed files with 11 additions and 8 deletions

View File

@ -3545,10 +3545,9 @@ void TrackPanelCellIterator::UpdateRect()
} }
case CellType::VRuler: case CellType::VRuler:
{ {
const int kGuard = 5; // 5 pixels to reduce risk of VZooming accidentally
mRect.x = kTrackInfoWidth; mRect.x = kTrackInfoWidth;
// Right edge of the VRuler is inactive. // Right edge of the VRuler is inactive.
mRect.width = mPanel->GetLeftOffset() - mRect.x -kGuard; mRect.width = mPanel->GetLeftOffset() - mRect.x;
mRect.y += kTopMargin; mRect.y += kTopMargin;
mRect.height -= (kBottomMargin + kTopMargin); mRect.height -= (kBottomMargin + kTopMargin);
} }

View File

@ -31,12 +31,16 @@ std::vector<UIHandlePtr> WaveTrackVRulerControls::HitTest
const AudacityProject *pProject) const AudacityProject *pProject)
{ {
std::vector<UIHandlePtr> results; std::vector<UIHandlePtr> results;
auto pTrack = Track::Pointer<WaveTrack>( FindTrack().get() );
if (pTrack) { const int kGuard = 5; // 5 pixels to reduce risk of VZooming accidentally
auto result = std::make_shared<WaveTrackVZoomHandle>( if ( st.state.GetX() <= st.rect.GetRight() - kGuard ) {
pTrack, st.rect, st.state.m_y ); auto pTrack = Track::Pointer<WaveTrack>( FindTrack().get() );
result = AssignUIHandlePtr(mVZoomHandle, result); if (pTrack) {
results.push_back(result); auto result = std::make_shared<WaveTrackVZoomHandle>(
pTrack, st.rect, st.state.m_y );
result = AssignUIHandlePtr(mVZoomHandle, result);
results.push_back(result);
}
} }
auto more = TrackVRulerControls::HitTest(st, pProject); auto more = TrackVRulerControls::HitTest(st, pProject);