[vlmc-devel] Timeline: Implement selecting clips by selectionRect

Yikai Lu git at videolan.org
Mon Aug 1 11:40:43 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul 30 16:04:45 2016 +0900| [d72d620956f0e73ecec8a3f010b1b7806a665373] | committer: Yikai Lu

Timeline: Implement selecting clips by selectionRect

> https://code.videolan.org/videolan/vlmc/commit/d72d620956f0e73ecec8a3f010b1b7806a665373
---

 src/Gui/timeline/main.qml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index e6e06d4..d83095f 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -347,6 +347,7 @@ Rectangle {
                 selectionRect.y = Math.min( mouseY + y, selectionRect.initPos.y );
                 selectionRect.width = Math.abs( mouseX + x - selectionRect.initPos.x );
                 selectionRect.height = Math.abs( mouseY + y - selectionRect.initPos.y );
+                selectionRect.selectClips();
             }
         }
 
@@ -485,6 +486,16 @@ Rectangle {
         visible: false
         color: "#999999cc"
         property point initPos
+
+        function selectClips() {
+            for ( var i = 0; i < allClips.length; ++i ) {
+                var clip = allClips[i];
+                var clipPos = clip.mapToItem( page, 0, 0 );
+                if ( ( x - clip.width < clipPos.x && clipPos.x < x + width ) &&
+                     ( y - clip.height < clipPos.y && clipPos.y < y + height ) )
+                    clip.selected = true;
+            }
+        }
     }
 
     MessageDialog {



More information about the Vlmc-devel mailing list