Commit f9fcbd05 authored by luyikei's avatar luyikei

Track.qml: Fix some unstable move

Sorry for those mistakes...
parent 692be057
...@@ -114,6 +114,7 @@ Item { ...@@ -114,6 +114,7 @@ Item {
// HACK: Call onPositoinChanged forcely here. // HACK: Call onPositoinChanged forcely here.
// x will be rounded so it won't affect actual its position. // x will be rounded so it won't affect actual its position.
drag.source.x = drag.source.x + 0.000001; drag.source.x = drag.source.x + 0.000001;
drag.source.forcePosition(); // Restore the binding
} }
} }
...@@ -127,6 +128,10 @@ Item { ...@@ -127,6 +128,10 @@ Item {
else else
dMode = dropMode.Move; dMode = dropMode.Move;
// Scroll to the drag source
if ( dMode === dropMode.Move )
drag.source.scrollToThis();
sortSelectedClips(); sortSelectedClips();
var toMove = selectedClips.concat(); var toMove = selectedClips.concat();
...@@ -146,7 +151,7 @@ Item { ...@@ -146,7 +151,7 @@ Item {
if ( newTrackId < 0 ) if ( newTrackId < 0 )
{ {
drag.source.newTrackId = oldTrackId; drag.source.newTrackId = oldTrackId;
drag.source.setPixelPosition( drag.source.pixelPosition() ); drag.source.forcePosition();
// Direction depends on its type // Direction depends on its type
drag.source.y += drag.source.y +=
...@@ -204,13 +209,13 @@ Item { ...@@ -204,13 +209,13 @@ Item {
if ( newLinkedClipPos !== newPos ) if ( newLinkedClipPos !== newPos )
deltaPos = 0 deltaPos = 0
else else
deltaPos = newPos - oldPos; linkedClipItem.position = target.position; // Link if possible
} }
else else
deltaPos = 0; deltaPos = 0;
} }
else else
deltaPos = newPos - oldPos; linkedClipItem.position = target.position; // Link if possible
var ind = toMove.indexOf( linkedClipItem.uuid ); var ind = toMove.indexOf( linkedClipItem.uuid );
if ( ind > 0 ) if ( ind > 0 )
...@@ -232,7 +237,7 @@ Item { ...@@ -232,7 +237,7 @@ Item {
target = findClipItem( selectedClips[i] ); target = findClipItem( selectedClips[i] );
newPos = target.position + deltaPos; newPos = target.position + deltaPos;
// We only want to update the length when the left edge of the timeline // We only want to update the length when the right edge of the timeline
// is exposed. // is exposed.
if ( sView.flickableItem.contentX + page.width > sView.width && if ( sView.flickableItem.contentX + page.width > sView.width &&
length < newPos + target.length ) { length < newPos + target.length ) {
...@@ -247,7 +252,7 @@ Item { ...@@ -247,7 +252,7 @@ Item {
} }
if ( dMode === dropMode.Move ) if ( dMode === dropMode.Move )
lastPos = ptof( drag.source.x ); lastPos = drag.source.position;
else else
lastPos = ptof( drag.x ); lastPos = ptof( drag.x );
} }
......
...@@ -76,8 +76,8 @@ Rectangle { ...@@ -76,8 +76,8 @@ Rectangle {
// but not if "clip" is also selected because both of them will be moving // but not if "clip" is also selected because both of them will be moving
// and we want to keep the same distance between them as much as possible // and we want to keep the same distance between them as much as possible
var clipMargin = useMagneticMode && findClipItem( clip.uuid ).selected === false ? ptof( magneticMargin ) : 0; var clipMargin = useMagneticMode && findClipItem( clip.uuid ).selected === false ? ptof( magneticMargin ) : 0;
cPos += clipMargin * 2; cPos -= clipMargin;
cEndPos -= clipMargin; cEndPos += clipMargin;
if ( cEndPos >= newPos && newPos + target.length - 1 >= cPos ) { if ( cEndPos >= newPos && newPos + target.length - 1 >= cPos ) {
if ( cPos >= newPos ) { if ( cPos >= newPos ) {
if ( cPos - target.length + 1 > 0 ) if ( cPos - target.length + 1 > 0 )
......
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