[vlmc-devel] Timeline: Better scrolling

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


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Jul 26 21:50:09 2016 +0900| [b81d4022415a5a69ae9d452bdbcdf3d45f91d5a5] | committer: Yikai Lu

Timeline: Better scrolling

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

 src/Gui/timeline/Track.qml | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/Gui/timeline/Track.qml b/src/Gui/timeline/Track.qml
index 1990ad2..d38aff2 100644
--- a/src/Gui/timeline/Track.qml
+++ b/src/Gui/timeline/Track.qml
@@ -318,21 +318,42 @@ Item {
                                         if ( Math.abs( newLinkedClipX - newX ) > 1 )
                                             newX = oldX;
                                     }
+
+                                    if ( length < ptof( newX + linkedClipItem.width ) ) {
+                                        length = ptof( newX + linkedClipItem.width );
+                                    }
+
                                     linkedClipItem.setPixelPosition( newX );
                                     alreadyCalculated.push( target.linkedClip );
                                 }
                             }
+
+                            if ( length < ptof( newX + target.width ) ) {
+                                length = ptof( newX + target.width );
+                            }
+
                             target.setPixelPosition( newX );
                             alreadyCalculated.push( target.uuid );
                         }
 
                         // Scroll if needed
-                        if ( length < ptof( newX ) ) {
-                            length = ptof( newX );
-                            // Never show the background behind the timeline
-                            var newContentX = sView.flickableItem.contentWidth - sView.width;
-                            if ( newContentX >= 0 )
-                                sView.flickableItem.contentX = newContentX;
+                        if ( drag.source === target || dMode === dropMode.New ) {
+
+                            while ( target.width > sView.width )
+                                zoomIn( 0.5 );
+
+                            if ( sView.flickableItem.contentX + sView.width <
+                                    newX + target.width + initPosOfCursor + sView.sViewPadding ) {
+                                // Never show the background behind the timeline
+                                var newContentX = sView.flickableItem.contentWidth - sView.width;
+                                if ( newContentX >= 0 ) {
+                                    drag.source.Drag.hotSpot.x = 0;
+                                    sView.flickableItem.contentX = newContentX;
+                                }
+                            }
+                            else if ( sView.flickableItem.contentX + sView.sViewPadding > newX + initPosOfCursor ) {
+                                sView.flickableItem.contentX = newX + initPosOfCursor - sView.sViewPadding;
+                            }
                         }
 
                         // Let's move to the new tracks



More information about the Vlmc-devel mailing list