Commit 96a93892 authored by luyikei's avatar luyikei

Track.qml: Fix unstable position changing when MagneticMode is on

Since I'm not sure when I could implement transitions, I fix the current collision detection now.
parent a782f3c2
......@@ -114,11 +114,14 @@ Item {
if ( isCollided ) {
for ( k = 0; k < clips.count; ++k ) {
clip = clips.get( k );
if ( clip.uuid === target.uuid )
continue;
cx = ftop( clip["position"] );
cw = ftop( clip["end"] - clip["begin"] + 1);
newX = Math.max( newX, cx + cw );
}
}
return newX;
}
......@@ -222,9 +225,6 @@ Item {
}
}
if ( drag.source.x !== findNewPosition( drag.source.x, drag.source, false ) )
deltaX = 0;
else
deltaX = drag.source.x - lastX;
}
else
......@@ -247,9 +247,10 @@ Item {
// If linked clip collides
if ( ptof( Math.abs( newLinkedClipX - newX ) ) !== 0 ) {
// Recalculate target's newX
// This time, don't use magnets
if ( isMagneticMode === true )
{
newX = findNewPosition( newLinkedClipX, target, false );
newLinkedClipX = findNewPosition( newX, target, false );
......@@ -257,6 +258,9 @@ Item {
if ( ptof( Math.abs( newLinkedClipX - newX ) ) !== 0 )
newX = oldX;
}
else
newX = oldX;
}
if ( length < ptof( newX + linkedClipItem.width ) ) {
length = ptof( newX + linkedClipItem.width );
......
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