1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-19 15:44:20 +01:00

Ruler event handler does not directly use zoom (pps) value

This commit is contained in:
Paul-Licameli
2015-04-20 00:50:21 -04:00
committed by Paul Licameli
parent bd08c7c778
commit c4386f4dc8
2 changed files with 6 additions and 10 deletions

View File

@@ -1803,17 +1803,12 @@ void AdornedRulerPanel::OnSize(wxSizeEvent & WXUNUSED(evt))
double AdornedRulerPanel::Pos2Time(int p)
{
return (p-mLeftOffset) / mViewInfo->zoom + mViewInfo->h;
return mViewInfo->PositionToTime(p, mLeftOffset);
}
int AdornedRulerPanel::Time2Pos(double t)
{
return mLeftOffset + Seconds2Pixels(t-mViewInfo->h);
}
int AdornedRulerPanel::Seconds2Pixels(double t)
{
return (int)(t * mViewInfo->zoom + 0.5);
return mViewInfo->TimeToPosition(t, mLeftOffset);
}
@@ -1903,7 +1898,6 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
if (!mQuickPlayEnabled)
return;
HandleSnapping();
if (evt.LeftDown())
@@ -1924,7 +1918,10 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
mMouseEventState = mesSelectingPlayRegionClick;
// otherwise check which marker is nearer
else {
if (fabs(mQuickPlayPos - mOldPlayRegionStart) < fabs(mQuickPlayPos - mOldPlayRegionEnd))
// Don't compare times, compare positions.
//if (fabs(mQuickPlayPos - mPlayRegionStart) < fabs(mQuickPlayPos - mPlayRegionEnd))
if (abs(Time2Pos(mQuickPlayPos) - Time2Pos(mPlayRegionStart)) <
abs(Time2Pos(mQuickPlayPos) - Time2Pos(mPlayRegionEnd)))
mMouseEventState = mesDraggingPlayRegionStart;
else
mMouseEventState = mesDraggingPlayRegionEnd;

View File

@@ -299,7 +299,6 @@ private:
double Pos2Time(int p);
int Time2Pos(double t);
int Seconds2Pixels(double t);
bool IsWithinMarker(int mousePosX, double markerTime);