Commit d41fb202 authored by Julius Künzel's avatar Julius Künzel
Browse files

[Timeline Zoombar] More improvements

parent 06107cab
Pipeline #117006 passed with stage
in 7 minutes and 28 seconds
......@@ -53,9 +53,9 @@ Rectangle {
id: zoomBar
height: parent.height
property int minWidth: barMinWidth + zoomEnd.width + zoomStart.width
property int preferedWidth: root.zoomBarWidth * zoomHandleContainer.width
property int preferedWidth: scrollView.visibleArea.widthRatio * zoomHandleContainer.width
width: !zoomStart.pressed && !zoomEnd.pressed && preferedWidth < minWidth ? minWidth : preferedWidth
x: root.zoomStart * zoomHandleContainer.width
x: scrollView.visibleArea.xPosition * zoomHandleContainer.width
MouseArea {
id: barArea
anchors.fill: parent
......@@ -99,9 +99,11 @@ Rectangle {
MouseArea {
id: zoomStart
property bool isActive: zoomStart.containsMouse || zoomStart.pressed
anchors.right: pressed ? undefined : zoomBar.left
anchors.rightMargin: -width
anchors.bottom: zoomBar.bottom
anchors {
right: pressed ? undefined : zoomBar.left
rightMargin: -width
bottom: zoomBar.bottom
}
width: zoomBar.height
height: zoomBar.height
hoverEnabled: true
......@@ -111,7 +113,7 @@ Rectangle {
var updatedPos = Math.max(0, x + mouseX)
updatedPos = Math.min(updatedPos, zoomEnd.x - width - 1)
var firstFrame = Math.round(updatedPos / (zoomHandleContainer.width) * flickable.contentWidth / timeline.scaleFactor)
var lastFrame = Math.round((zoomBar.x + zoomBar.width) / (zoomHandleContainer.width) * flickable.contentWidth / timeline.scaleFactor)
var lastFrame = Math.round((zoomBar.x + zoomBar.width + 0.5) / (zoomHandleContainer.width) * flickable.contentWidth / timeline.scaleFactor)
root.zoomOnBar = firstFrame
timeline.scaleFactor = flickable.width / (lastFrame - firstFrame)
startHandleRect.x = updatedPos - x
......@@ -133,9 +135,11 @@ Rectangle {
MouseArea {
id: zoomEnd
property bool isActive: zoomEnd.containsMouse || zoomEnd.pressed
anchors.left: pressed ? undefined : zoomBar.right
anchors.leftMargin: -width
anchors.bottom: zoomBar.bottom
anchors {
left: pressed ? undefined : zoomBar.right
leftMargin: -width
bottom: zoomBar.bottom
}
width: zoomBar.height
height: zoomBar.height
hoverEnabled: true
......
......@@ -32,10 +32,6 @@ Rectangle {
signal processingDrag(bool dragging)
signal showSubtitleClipMenu()
// Zoombar properties
property double zoomStart: scrollView.visibleArea.xPosition
property double zoomBarWidth: scrollView.visibleArea.widthRatio
FontMetrics {
id: fontMetrics
font: miniFont
......@@ -1840,7 +1836,7 @@ Rectangle {
}
ZoomBar {
id: horZoomBar
visible: root.zoomBarWidth < 1
visible: scrollView.visibleArea.widthRatio < 1
anchors {
left: parent.left
right: parent.right
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment