[vlmc-devel] Timeline: Make clips semi-transparent if they are being dragged

Yikai Lu git at videolan.org
Mon Jul 10 18:31:34 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Jul 11 01:28:48 2017 +0900| [9d5745a59f0284da61f059987a179ff45999b777] | committer: Yikai Lu

Timeline: Make clips semi-transparent if they are being dragged

> https://code.videolan.org/videolan/vlmc/commit/9d5745a59f0284da61f059987a179ff45999b777
---

 src/Gui/timeline/Clip.qml | 18 ++++++++++--------
 src/Gui/timeline/main.qml |  2 ++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/Gui/timeline/Clip.qml b/src/Gui/timeline/Clip.qml
index 34188617..4d117b84 100644
--- a/src/Gui/timeline/Clip.qml
+++ b/src/Gui/timeline/Clip.qml
@@ -20,6 +20,7 @@ Rectangle {
     radius: 2
     border.color: "#1f546f"
     border.width: 1
+    opacity: page.dragging === true && selectedClips.indexOf( uuid ) !== -1 ? 0.5 : 1.0
 
     property alias name: text.text
     property alias thumbnailSource: thumbnailImage.source
@@ -322,14 +323,14 @@ Rectangle {
         onPressed: {
             clip.Drag.hotSpot = Qt.point( mouseX, clip.height / 2 );
 
-            if ( selected === true )
-                return;
-
-            if ( !( mouse.modifiers & Qt.ControlModifier ) )
-                clearSelectedClips();
-
-            if ( mouse.button & Qt.LeftButton )
-                selected = true;
+            if ( mouse.button & Qt.LeftButton ) {
+                if ( selected === false ) {
+                    if ( !( mouse.modifiers & Qt.ControlModifier ) )
+                        clearSelectedClips();
+                    selected = true;
+                }
+                page.dragging = true;
+            }
         }
 
         onClicked: {
@@ -343,6 +344,7 @@ Rectangle {
                     return;
                 workflow.splitClip( uuid, newClipPos, newClipBegin );
             }
+            page.dragging = false;
         }
 
         onReleased: {
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index d1e04ff8..97a2c4ef 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -24,6 +24,7 @@ Rectangle {
     property var linkedClipsDict: ({}) // Uuid
     property alias isMagneticMode: magneticModeButton.selected
     property bool isCutMode: false
+    property bool dragging: false
 
     property int trackHeight: 60
 
@@ -325,6 +326,7 @@ Rectangle {
     }
 
     function dragFinished() {
+        dragging = false;
         sortSelectedClips();
 
         // We don't want to rely on selectedClips while moving since it "will" be changed



More information about the Vlmc-devel mailing list