This commit is contained in:
xenakios 2018-03-02 23:37:52 +02:00
parent f474b022f0
commit 9212069e65

View File

@ -757,8 +757,11 @@ void WaveformComponent::mouseWheelMove(const MouseEvent & e, const MouseWheelDet
double normt = viewXToNormalized(e.x); double normt = viewXToNormalized(e.x);
double curlen = m_view_range.getLength(); double curlen = m_view_range.getLength();
double newlen = curlen * factor; double newlen = curlen * factor;
double t0 = jlimit(0.0,1.0, normt - newlen / 2.0); double oldt0 = m_view_range.getStart();
double t1 = jlimit(t0,1.0, t0 + newlen); double oldt1 = m_view_range.getEnd();
double t0 = jlimit(0.0,1.0, normt + (curlen - newlen));
double t1 = jlimit(0.0,1.0, t0+newlen);
jassert(t1 > t0);
m_view_range = { t0,t1 }; m_view_range = { t0,t1 };
//m_view_range = m_view_range.constrainRange({ 0.0, 1.0 }); //m_view_range = m_view_range.constrainRange({ 0.0, 1.0 });
jassert(m_view_range.getStart() >= 0.0 && m_view_range.getEnd() <= 1.0); jassert(m_view_range.getStart() >= 0.0 && m_view_range.getEnd() <= 1.0);