Commit a4653c7e authored by Ludovic Fauvet's avatar Ludovic Fauvet

timeline: do not re-center the viewport vertically when the cursor move.

parent 5a43f4e1
......@@ -1061,13 +1061,22 @@ TracksView::ensureCursorVisible()
{
if ( horizontalScrollBar()->isVisible() )
{
QRectF r( m_cursorLine->boundingRect().width() / 2,
m_cursorLine->boundingRect().height() / 2,
1, 1 );
m_cursorLine->ensureVisible( r, 150, 50 );
QRectF visibleArea = visibleRect();
ensureVisible( cursorPos(),
visibleArea.y() + ( visibleArea.height() / 2 ),
1, 1, 150, 0 );
}
}
QRectF
TracksView::visibleRect()
{
QPointF topLeft( horizontalScrollBar()->value(), verticalScrollBar()->value() );
QPointF bottomRight( topLeft + viewport()->rect().bottomRight() );
QMatrix reverted = matrix().inverted();
return reverted.mapRect( QRectF( topLeft, bottomRight ) );
}
void
TracksView::updateDuration()
{
......
......@@ -232,6 +232,11 @@ private slots:
* \brief Ensure that the cursor is visible.
*/
void ensureCursorVisible();
/**
* \brief Return the visible area of the viewport.
*/
QRectF visibleRect();
/**
* \brief Update the global duration of the project.
* This method should be called when an item is inserted, moved or removed to ensure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment