From 32136296d1a201ed56ba1002ec08b8ff7ed25cd3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Fri, 28 Feb 2020 07:59:24 +0100 Subject: [PATCH] Fix broken timeline header position in some cases --- src/timeline2/view/qml/TrackHead.qml | 12 +++++------- src/timeline2/view/qml/timeline.qml | 12 ++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/timeline2/view/qml/TrackHead.qml b/src/timeline2/view/qml/TrackHead.qml index 20458d8a9..634e6912f 100644 --- a/src/timeline2/view/qml/TrackHead.qml +++ b/src/timeline2/view/qml/TrackHead.qml @@ -38,10 +38,8 @@ Rectangle { property int iconSize: buttonSize - 4 property string trackTag property int thumbsFormat: 0 - property int collapsedHeight: buttonSize border.width: 1 border.color: root.frameColor - signal clicked() function pulseLockButton() { flashLock.restart(); @@ -82,7 +80,7 @@ Rectangle { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: { - parent.clicked() + timeline.activeTrack = trackId if (mouse.button == Qt.RightButton) { root.showHeaderMenu() } @@ -197,7 +195,7 @@ Rectangle { //icon.height: trackHeadRoot.iconSize icon.name: trackHeadRoot.collapsed ? 'arrow-right' : 'arrow-down' onClicked: { - trackHeadRoot.myTrackHeight = trackHeadRoot.collapsed ? Math.max(collapsedHeight * 1.5, controller.getTrackProperty(trackId, "kdenlive:trackheight")) : collapsedHeight + trackHeadRoot.myTrackHeight = trackHeadRoot.collapsed ? Math.max(root.collapsedHeight * 1.5, controller.getTrackProperty(trackId, "kdenlive:trackheight")) : root.collapsedHeight } ToolTip { visible: expandButton.hovered @@ -419,7 +417,7 @@ Rectangle { } onClicked: { timeline.showTrackAsset(trackId) - trackHeadRoot.clicked() + timeline.activeTrack = trackId trackHeadRoot.focus = true } onEntered: { @@ -497,7 +495,7 @@ Rectangle { cursorShape: Qt.SizeVerCursor drag.target: parent drag.axis: Drag.YAxis - drag.minimumY: trackHeadRoot.collapsedHeight - resizer.height + drag.minimumY: root.collapsedHeight - resizer.height property double startY property double originalY drag.smoothed: false @@ -522,7 +520,7 @@ Rectangle { if (mouse.buttons === Qt.LeftButton) { parent.opacity = 0.5 var newHeight = originalY + (mapToItem(null, x, y).y - startY) - newHeight = Math.max(trackHeadRoot.collapsedHeight, newHeight) + newHeight = Math.max(root.collapsedHeight, newHeight) trackHeadRoot.myTrackHeight = newHeight } } diff --git a/src/timeline2/view/qml/timeline.qml b/src/timeline2/view/qml/timeline.qml index c3c10ad4c..232fc0312 100644 --- a/src/timeline2/view/qml/timeline.qml +++ b/src/timeline2/view/qml/timeline.qml @@ -265,6 +265,7 @@ Rectangle { property int scrollMin: scrollView.contentX / timeline.scaleFactor property int scrollMax: scrollMin + scrollView.contentItem.width / timeline.scaleFactor property double dar: 16/9 + property int collapsedHeight: baseUnit * 1.8 onSeekingFinishedChanged : { playhead.opacity = seekingFinished ? 1 : 0.5 @@ -296,7 +297,10 @@ Rectangle { if (tk.y < scrollView.contentY) { scrollView.contentY = Math.max(0, tk.y - scrollView.height / 3) } else if (tk.y + tk.height > scrollView.contentY + scrollView.contentItem.height) { - scrollView.contentY = Math.min(trackHeaders.height - scrollView.height + scrollView.ScrollBar.horizontal.height, tk.y - scrollView.height / 3) + var newY = Math.min(trackHeaders.height - scrollView.height + scrollView.ScrollBar.horizontal.height, tk.y - scrollView.height / 3) + if (newY >= 0) { + scrollView.contentY = newY + } } } @@ -668,10 +672,6 @@ Rectangle { // hack: change property to trigger transition adjustment root.trackHeight = root.trackHeight === 1 ? 0 : 1 } - onClicked: { - timeline.activeTrack = tracksRepeater.itemAt(index).trackInternalId - console.log('track name: ',index, ' = ', model.name,'/',tracksRepeater.itemAt(index).trackInternalId) - } } } } @@ -1165,7 +1165,7 @@ Rectangle { width: tracksContainerArea.width border.width: 1 border.color: root.frameColor - height: Math.max(root.baseUnit * 2, model.trackHeight) + height: Math.max(collapsedHeight, model.trackHeight) color: tracksRepeater.itemAt(index) ? ((tracksRepeater.itemAt(index).trackInternalId === timeline.activeTrack) ? Qt.tint(getTrackColor(tracksRepeater.itemAt(index).isAudio, false), selectedTrackColor) : getTrackColor(tracksRepeater.itemAt(index).isAudio, false)) : 'red' } } -- GitLab