Commit 410b280a authored by Ludovic Fauvet's avatar Ludovic Fauvet

Let the user move an item even if the mouse cursor is not on a track

parent 4e7a0055
...@@ -167,7 +167,9 @@ void TracksView::moveMediaItem( const QUuid& uuid, unsigned int track, qint64 ti ...@@ -167,7 +167,9 @@ void TracksView::moveMediaItem( const QUuid& uuid, unsigned int track, qint64 ti
void TracksView::moveMediaItem( AbstractGraphicsMediaItem* item, QPoint position ) void TracksView::moveMediaItem( AbstractGraphicsMediaItem* item, QPoint position )
{ {
static GraphicsTrack* lastKnownTrack = NULL;
GraphicsTrack* track = NULL; GraphicsTrack* track = NULL;
QList<QGraphicsItem*> list = items( 0, position.y() ); QList<QGraphicsItem*> list = items( 0, position.y() );
for ( int i = 0; i < list.size(); ++i ) for ( int i = 0; i < list.size(); ++i )
{ {
...@@ -175,7 +177,16 @@ void TracksView::moveMediaItem( AbstractGraphicsMediaItem* item, QPoint position ...@@ -175,7 +177,16 @@ void TracksView::moveMediaItem( AbstractGraphicsMediaItem* item, QPoint position
if (track) break; if (track) break;
} }
if (!track) return; if ( !track )
{
// When the mouse pointer is not on a track,
// use the last known track.
// This avoids "breaks" when moving a rush
if ( !lastKnownTrack ) return;
track = lastKnownTrack;
}
lastKnownTrack = track;
qreal time = ( mapToScene( position ).x() + 0.5 ); qreal time = ( mapToScene( position ).x() + 0.5 );
moveMediaItem( item, track->trackNumber(), (int)time); moveMediaItem( item, track->trackNumber(), (int)time);
......
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