Don't draw position arrow when line is out of view (#6191)

Also hides timeline numbers above the piano keys.
This commit is contained in:
Alex
2021-11-20 03:15:07 +01:00
committed by GitHub
parent 99d887610d
commit 445b55f0f5

View File

@@ -238,7 +238,8 @@ void TimeLineWidget::paintEvent( QPaintEvent * )
p.fillRect( 0, 0, width(), height(), p.background() );
// Clip so that we only draw everything starting from the offset
p.setClipRect( m_xOffset, 0, width() - m_xOffset, height() );
const int leftMargin = m_xOffset + s_posMarkerPixmap->width() / 2;
p.setClipRect(leftMargin, 0, width() - leftMargin, height() );
// Draw the loop rectangle
int const & loopRectMargin = getLoopRectangleVerticalPadding();
@@ -296,9 +297,14 @@ void TimeLineWidget::paintEvent( QPaintEvent * )
p.setBrush( Qt::NoBrush );
p.drawRect( innerRectangle );
// Draw the position marker
p.setOpacity( 0.6 );
p.drawPixmap( m_posMarkerX, height() - s_posMarkerPixmap->height(), *s_posMarkerPixmap );
// Only draw the position marker if the position line is in view
if (m_posMarkerX >= m_xOffset && m_posMarkerX < width() - s_posMarkerPixmap->width() / 2)
{
// Let the position marker extrude to the left
p.setClipping(false);
p.setOpacity(0.6);
p.drawPixmap(m_posMarkerX, height() - s_posMarkerPixmap->height(), *s_posMarkerPixmap);
}
}