[vlmc-devel] main.qml: Limit the MouseArea within TrackContainers

Yikai Lu git at videolan.org
Mon Jul 18 15:39:57 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Jul 18 17:48:28 2016 +0900| [8ac2568c309bfafa9fb5e599a2abdd61b4584d28] | committer: Yikai Lu

main.qml: Limit the MouseArea within TrackContainers

> https://code.videolan.org/videolan/vlmc/commit/8ac2568c309bfafa9fb5e599a2abdd61b4584d28
---

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

diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index 71b1f3c..3642251 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -234,24 +234,27 @@ Rectangle {
 
     MouseArea {
         id: selectionArea
-        anchors.fill: page
+        width: parent.width - initPosOfCursor
+        height: audioTrackContainer.y + audioTrackContainer.height - videoTrackContainer.y
+        y: videoTrackContainer.y
+        x: initPosOfCursor
 
         onPressed: {
             clearSelectedClips();
             selectionRect.visible = true;
-            selectionRect.x = mouseX;
-            selectionRect.y = mouseY;
+            selectionRect.x = mouseX + x;
+            selectionRect.y = mouseY + y;
             selectionRect.width = 0;
             selectionRect.height = 0;
-            selectionRect.initPos = Qt.point( mouseX, mouseY );
+            selectionRect.initPos = Qt.point( mouseX + x, mouseY + y );
         }
 
         onPositionChanged: {
             if ( selectionRect.visible === true ) {
-                selectionRect.x = Math.min( mouseX, selectionRect.initPos.x );
-                selectionRect.y = Math.min( mouseY, selectionRect.initPos.y );
-                selectionRect.width = Math.abs( mouseX - selectionRect.initPos.x );
-                selectionRect.height = Math.abs( mouseY - selectionRect.initPos.y );
+                selectionRect.x = Math.min( mouseX + x, selectionRect.initPos.x );
+                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 );
             }
         }
 



More information about the Vlmc-devel mailing list