[vlmc-devel] Track.qml: Fix some unstable move
Yikai Lu
git at videolan.org
Sat Jul 29 16:39:57 CEST 2017
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul 29 22:53:15 2017 +0900| [f9fcbd055fa8faa2a7d83ffd517929e8b348b27c] | committer: Yikai Lu
Track.qml: Fix some unstable move
Sorry for those mistakes...
> https://code.videolan.org/videolan/vlmc/commit/f9fcbd055fa8faa2a7d83ffd517929e8b348b27c
---
src/Gui/timeline/Track.qml | 15 ++++++++++-----
src/Gui/timeline/main.qml | 4 ++--
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/Gui/timeline/Track.qml b/src/Gui/timeline/Track.qml
index 83d8ed90..46e58c50 100644
--- a/src/Gui/timeline/Track.qml
+++ b/src/Gui/timeline/Track.qml
@@ -114,6 +114,7 @@ Item {
// HACK: Call onPositoinChanged forcely here.
// x will be rounded so it won't affect actual its position.
drag.source.x = drag.source.x + 0.000001;
+ drag.source.forcePosition(); // Restore the binding
}
}
@@ -127,6 +128,10 @@ Item {
else
dMode = dropMode.Move;
+ // Scroll to the drag source
+ if ( dMode === dropMode.Move )
+ drag.source.scrollToThis();
+
sortSelectedClips();
var toMove = selectedClips.concat();
@@ -146,7 +151,7 @@ Item {
if ( newTrackId < 0 )
{
drag.source.newTrackId = oldTrackId;
- drag.source.setPixelPosition( drag.source.pixelPosition() );
+ drag.source.forcePosition();
// Direction depends on its type
drag.source.y +=
@@ -204,13 +209,13 @@ Item {
if ( newLinkedClipPos !== newPos )
deltaPos = 0
else
- deltaPos = newPos - oldPos;
+ linkedClipItem.position = target.position; // Link if possible
}
else
deltaPos = 0;
}
else
- deltaPos = newPos - oldPos;
+ linkedClipItem.position = target.position; // Link if possible
var ind = toMove.indexOf( linkedClipItem.uuid );
if ( ind > 0 )
@@ -232,7 +237,7 @@ Item {
target = findClipItem( selectedClips[i] );
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.
if ( sView.flickableItem.contentX + page.width > sView.width &&
length < newPos + target.length ) {
@@ -247,7 +252,7 @@ Item {
}
if ( dMode === dropMode.Move )
- lastPos = ptof( drag.source.x );
+ lastPos = drag.source.position;
else
lastPos = ptof( drag.x );
}
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index 88919de6..96b827e7 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -76,8 +76,8 @@ Rectangle {
// 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
var clipMargin = useMagneticMode && findClipItem( clip.uuid ).selected === false ? ptof( magneticMargin ) : 0;
- cPos += clipMargin * 2;
- cEndPos -= clipMargin;
+ cPos -= clipMargin;
+ cEndPos += clipMargin;
if ( cEndPos >= newPos && newPos + target.length - 1 >= cPos ) {
if ( cPos >= newPos ) {
if ( cPos - target.length + 1 > 0 )
More information about the Vlmc-devel
mailing list