Commit b217b416 authored by luyikei's avatar luyikei

Track.qml: Move clips to other tracks in a right order

parent a00b6b5f
...@@ -206,29 +206,27 @@ Item { ...@@ -206,29 +206,27 @@ Item {
else else
dMode = dropMode.Move; dMode = dropMode.Move;
sortSelectedClips();
var toMove = selectedClips.concat(); var toMove = selectedClips.concat();
if ( dMode === dropMode.Move ) { if ( dMode === dropMode.Move ) {
// Move to the top
drag.source.parent.parent.z = ++maxZ;
// Prepare newTrackId for all the selected clips // Prepare newTrackId for all the selected clips
var oldTrackId = drag.source.newTrackId;
drag.source.newTrackId = trackId;
for ( var i = 0; i < toMove.length; ++i ) { for ( var i = 0; i < toMove.length; ++i ) {
var target = findClipItem( toMove[i] ); var target = findClipItem( toMove[i] );
if ( drag.source === target ) { if ( target !== drag.source ) {
drag.source.parent.parent.z = ++maxZ; target.newTrackId = Math.max( 0, trackId - oldTrackId + target.trackId );
var oldTrackId = target.newTrackId; if ( target.newTrackId !== target.trackId ) {
target.newTrackId = trackId; // Let's move to the new tracks
for ( var j = 0; j < selectedClips.length; ++j ) {
if ( drag.source.uuid !== selectedClips[j] )
{
var clip = findClipItem( selectedClips[j] );
clip.newTrackId = Math.max( 0, trackId - oldTrackId + clip.trackId );
}
}
}
// Let's move to the new tracks
else if ( target.newTrackId !== target.trackId ) {
target.clipInfo["selected"] = true; target.clipInfo["selected"] = true;
addClip( target.type, target.newTrackId, target.clipInfo ); addClip( target.type, target.newTrackId, target.clipInfo );
removeClipFromTrack( target.type, target.trackId, target.uuid ); removeClipFromTrack( target.type, target.trackId, target.uuid );
}
} }
} }
...@@ -245,9 +243,9 @@ Item { ...@@ -245,9 +243,9 @@ Item {
var newX = findNewPosition( Math.max( oldX + deltaX, 0 ), target, drag.source, isMagneticMode ); var newX = findNewPosition( Math.max( oldX + deltaX, 0 ), target, drag.source, isMagneticMode );
// Let's find newX of the linked clip // Let's find newX of the linked clip
for ( j = 0; j < target.linkedClips.length; ++j ) for ( i = 0; i < target.linkedClips.length; ++i )
{ {
var linkedClipItem = findClipItem( target.linkedClips[j] ); var linkedClipItem = findClipItem( target.linkedClips[i] );
if ( linkedClipItem ) { if ( linkedClipItem ) {
var newLinkedClipX = findNewPosition( newX, linkedClipItem, drag.source, isMagneticMode ); var newLinkedClipX = findNewPosition( newX, linkedClipItem, drag.source, isMagneticMode );
......
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