Commit 8580bf21 authored by Nicolas Carion's avatar Nicolas Carion

fix razor tool not working in some cases. Fixes #160

parent 7b2afc26
...@@ -855,6 +855,11 @@ Rectangle { ...@@ -855,6 +855,11 @@ Rectangle {
rubberSelect.width = 0 rubberSelect.width = 0
rubberSelect.height = 0 rubberSelect.height = 0
} else if (mouse.button & Qt.LeftButton) { } else if (mouse.button & Qt.LeftButton) {
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 (dragProxy.draggedItem > -1) { if (dragProxy.draggedItem > -1) {
mouse.accepted = false mouse.accepted = false
return return
...@@ -878,10 +883,6 @@ Rectangle { ...@@ -878,10 +883,6 @@ Rectangle {
} }
timeline.seekPosition = Math.min((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor, timeline.fullDuration - 1) timeline.seekPosition = Math.min((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor, timeline.fullDuration - 1)
timeline.position = timeline.seekPosition timeline.position = timeline.seekPosition
} else 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)
} }
} else if (mouse.button & Qt.RightButton) { } else if (mouse.button & Qt.RightButton) {
menu.clickedX = mouse.x menu.clickedX = mouse.x
...@@ -909,6 +910,12 @@ Rectangle { ...@@ -909,6 +910,12 @@ Rectangle {
clickY = mouseY clickY = mouseY
return return
} }
if (!pressed && !rubberSelect.visible && root.activeTool === 1) {
cutLine.x = Math.floor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor) * timeline.scaleFactor - scrollView.flickableItem.contentX
if (mouse.modifiers & Qt.ShiftModifier) {
timeline.position = Math.floor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor)
}
}
if (dragProxy.draggedItem > -1) { if (dragProxy.draggedItem > -1) {
mouse.accepted = false mouse.accepted = false
return return
...@@ -951,12 +958,6 @@ Rectangle { ...@@ -951,12 +958,6 @@ Rectangle {
scim = true scim = true
} else { } else {
scim = false scim = false
if (root.activeTool === 1) {
cutLine.x = Math.floor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor) * timeline.scaleFactor - scrollView.flickableItem.contentX
if (mouse.modifiers & Qt.ShiftModifier) {
timeline.position = Math.floor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor)
}
}
} }
} }
onReleased: { onReleased: {
......
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