Fix seeking with mouse wheel on timeline ruler

parent b97adae7
Pipeline #9028 passed with stage
in 16 minutes and 45 seconds
......@@ -34,6 +34,7 @@ Rectangle {
property int labelMod: 1
property bool useTimelineRuler : timeline.useRuler
property bool showZoneLabels: false
property bool resizeActive: false // Used to decide which mouse cursor we should display
function adjustStepSize() {
if (timeline.scaleFactor > 19) {
......@@ -151,15 +152,24 @@ Rectangle {
anchors.fill: parent
property double startX
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: zone
drag.axis: Drag.XAxis
drag.smoothed: false
onPressed: {
startX = zone.x
}
onEntered: {
resizeActive = true
}
onExited: {
resizeActive = false
}
onReleased: {
resizeActive = false
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
resizeActive = true
var offset = Math.round(zone.x/ timeline.scaleFactor) - timeline.zoneIn
if (offset != 0) {
var newPos = Math.max(0, controller.suggestSnapPoint(timeline.zoneIn + offset,root.snapping))
......@@ -232,20 +242,28 @@ Rectangle {
id: trimInMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: parent
drag.axis: Drag.XAxis
drag.smoothed: false
onEntered: {
resizeActive = true
parent.opacity = 1
}
onExited: {
resizeActive = false
parent.opacity = 0
}
onPressed: {
parent.anchors.left = undefined
parent.opacity = 1
}
onReleased: {
resizeActive = false
parent.anchors.left = zone.left
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
resizeActive = true
var newPos = controller.suggestSnapPoint(timeline.zoneIn + Math.round(trimIn.x / timeline.scaleFactor), root.snapping)
if (newPos < 0) {
newPos = 0
......@@ -253,8 +271,6 @@ Rectangle {
timeline.zoneIn = timeline.zoneOut > -1 ? Math.min(newPos, timeline.zoneOut - 1) : newPos
}
}
onEntered: parent.opacity = 1
onExited: parent.opacity = 0
}
}
Rectangle {
......@@ -272,25 +288,31 @@ Rectangle {
id: trimOutMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: parent
drag.axis: Drag.XAxis
drag.smoothed: false
onEntered: {
resizeActive = true
parent.opacity = 1
}
onExited: {
resizeActive = false
parent.opacity = 0
}
onPressed: {
parent.anchors.right = undefined
parent.opacity = 1
}
onReleased: {
resizeActive = false
parent.anchors.right = zone.right
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
resizeActive = true
timeline.zoneOut = Math.max(controller.suggestSnapPoint(timeline.zoneIn + Math.round((trimOut.x + trimOut.width) / timeline.scaleFactor), root.snapping), timeline.zoneIn + 1)
}
}
onEntered: parent.opacity = 1
onExited: parent.opacity = 0
}
}
}
......
......@@ -854,7 +854,7 @@ Rectangle {
// This provides continuous scrubbing and scimming at the left/right edges.
hoverEnabled: true
acceptedButtons: Qt.RightButton | Qt.LeftButton | Qt.MidButton
cursorShape: tracksArea.mouseY < ruler.height || root.activeTool === 0 ? Qt.ArrowCursor : root.activeTool === 1 ? Qt.IBeamCursor : Qt.SplitHCursor
cursorShape: root.activeTool === 0 ? Qt.ArrowCursor : root.activeTool === 1 ? Qt.IBeamCursor : Qt.SplitHCursor
onWheel: {
if (wheel.modifiers & Qt.AltModifier) {
// Alt + wheel = seek to next snap point
......@@ -892,7 +892,9 @@ Rectangle {
if (root.activeTool === 1) {
// razor tool
var y = mouse.y - ruler.height + scrollView.flickableItem.contentY
timeline.cutClipUnderCursor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor, tracksRepeater.itemAt(Logic.getTrackIndexFromPos(y)).trackInternalId)
if (y >= 0) {
timeline.cutClipUnderCursor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor, tracksRepeater.itemAt(Logic.getTrackIndexFromPos(y)).trackInternalId)
}
}
if (dragProxy.draggedItem > -1) {
mouse.accepted = false
......@@ -1065,8 +1067,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
onWheel: zoomByWheel(wheel)
cursorShape: dragProxyArea.drag.active ? Qt.ClosedHandCursor : tracksArea.cursorShape
cursorShape: ruler.resizeActive ? Qt.SizeHorCursor : dragProxyArea.drag.active ? Qt.ClosedHandCursor : tracksArea.cursorShape
}
}
}
......
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