[vlmc-devel] Track.qml: Check entity of linkedClip

Yikai Lu git at videolan.org
Sat Jul 23 12:06:26 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul 23 18:01:59 2016 +0900| [61cb66244ebd1f55981caaa3ac16ceea708e7e05] | committer: Yikai Lu

Track.qml: Check entity of linkedClip

> https://code.videolan.org/videolan/vlmc/commit/61cb66244ebd1f55981caaa3ac16ceea708e7e05
---

 src/Gui/timeline/Track.qml | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/Gui/timeline/Track.qml b/src/Gui/timeline/Track.qml
index 2da57b1..2ef9010 100644
--- a/src/Gui/timeline/Track.qml
+++ b/src/Gui/timeline/Track.qml
@@ -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 );



More information about the Vlmc-devel mailing list