[vlmc-devel] Track.qml: Use a const value for the margin of magnets

Yikai Lu git at videolan.org
Tue Jul 26 16:12:40 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Jul 26 21:45:06 2016 +0900| [7a275db866c1da7f8e383d237bd381cc83e51e65] | committer: Yikai Lu

Track.qml: Use a const value for the margin of magnets

> https://code.videolan.org/videolan/vlmc/commit/7a275db866c1da7f8e383d237bd381cc83e51e65
---

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

diff --git a/src/Gui/timeline/Track.qml b/src/Gui/timeline/Track.qml
index 5cce650..4849699 100644
--- a/src/Gui/timeline/Track.qml
+++ b/src/Gui/timeline/Track.qml
@@ -74,6 +74,8 @@ Item {
                 anchors.fill: parent
                 keys: ["Clip", "vlmc/uuid"]
 
+                readonly property int magneticMargin: 25
+
                 property string currentUuid
                 property var aClipInfo: null
                 property var vClipInfo: null
@@ -85,7 +87,7 @@ Item {
                     var oldX = target.pixelPosition();
 
                     if ( useMagneticMode === true ) {
-                        var leastDestance = 25;
+                        var leastDestance = magneticMargin;
                         // Check two times
                         for ( var k = 0; k < 2; ++k ) {
                             for ( var j = 0; j < markers.count; ++j ) {
@@ -125,16 +127,16 @@ Item {
                                 if ( cx  + cw > newX && newX + sw > cx )
                                     isCollided = true;
 
-                                cw += 50
-                                cx -= 25
+                                cw += magneticMargin * 2
+                                cx -= magneticMargin
                                 if ( cx + cw > newX && newX + sw > cx ) {
                                     if ( cx > newX ) {
                                         if ( cx - sw > 0 )
-                                            newX = cx - sw + 25;
+                                            newX = cx - sw + magneticMargin;
                                         else
                                             newX = oldX;
                                     } else {
-                                        newX = cx + cw - 25;
+                                        newX = cx + cw - magneticMargin;
                                     }
                                 }
                             }



More information about the Vlmc-devel mailing list