Skip to content
Snippets Groups Projects
Commit 61cb6624 authored by luyikei's avatar luyikei
Browse files

Track.qml: Check entity of linkedClip

parent 75346155
No related branches found
No related tags found
No related merge requests found
......@@ -294,22 +294,25 @@ Item {
// Let's find newX of the linked clip
if ( target.linked === true ) {
var linkedClipItem = findClipItem( target.linkedClip );
var newLinkedClipX = findNewPosition( newX, linkedClipItem, isMagneticMode );
// If linked clip collides
if ( Math.abs( newLinkedClipX - newX ) > 1 ) {
if ( linkedClipItem ) {
var newLinkedClipX = findNewPosition( newX, linkedClipItem, isMagneticMode );
// Recalculate target's newX
// This time, don't use magnets
newX = findNewPosition( newLinkedClipX, target, false );
newLinkedClipX = findNewPosition( newX, target, false );
// If linked clip collides
if ( Math.abs( newLinkedClipX - newX ) > 1 ) {
// And if newX collides again, we don't move
if ( Math.abs( newLinkedClipX - newX ) > 1 )
newX = oldX;
// Recalculate target's newX
// This time, don't use magnets
newX = findNewPosition( newLinkedClipX, target, false );
newLinkedClipX = findNewPosition( newX, target, false );
// And if newX collides again, we don't move
if ( Math.abs( newLinkedClipX - newX ) > 1 )
newX = oldX;
}
linkedClipItem.setPixelPosition( newX );
alreadyCalculated.push( target.linkedClip );
}
linkedClipItem.setPixelPosition( newX );
alreadyCalculated.push( target.linkedClip );
}
target.setPixelPosition( newX );
alreadyCalculated.push( target.uuid );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment