Fix crash when zooming out during knife mode (#6184)

This commit is contained in:
Alex
2021-10-05 03:41:36 +02:00
committed by GitHub
parent e1d5391f22
commit f16ec9c054

View File

@@ -2760,7 +2760,7 @@ void PianoRoll::updateKnifePos(QMouseEvent* me)
{
// Calculate the TimePos from the mouse
int mouseViewportPos = me->x() - m_whiteKeyWidth;
int mouseTickPos = mouseViewportPos / (m_ppb / TimePos::ticksPerBar()) + m_currentPosition;
int mouseTickPos = mouseViewportPos * TimePos::ticksPerBar() / m_ppb + m_currentPosition;
// If ctrl is not pressed, quantize the position
if (!(me->modifiers() & Qt::ControlModifier))