Improve timeline position on zoom

parent 5d18da44
Pipeline #20104 passed with stage
in 9 minutes and 36 seconds
...@@ -160,6 +160,16 @@ Rectangle { ...@@ -160,6 +160,16 @@ Rectangle {
return -1; return -1;
} }
} }
function getMouseX() {
if (dragProxy.draggedItem > -1 && dragProxy.masterObject) {
return (dragProxy.masterObject.x + dragProxy.masterObject.mouseXPos) - scrollView.contentX
}
if (tracksArea.containsMouse) {
return tracksArea.mouseX
} else {
return -1;
}
}
function getScrollPos() { function getScrollPos() {
return scrollView.contentX return scrollView.contentX
...@@ -298,7 +308,7 @@ Rectangle { ...@@ -298,7 +308,7 @@ Rectangle {
//onCurrentTrackChanged: timeline.selection = [] //onCurrentTrackChanged: timeline.selection = []
onTimeScaleChanged: { onTimeScaleChanged: {
if (root.zoomOnMouse >= 0) { if (root.zoomOnMouse >= 0) {
scrollView.contentX = Math.max(0, root.zoomOnMouse * timeline.scaleFactor - tracksArea.mouseX) scrollView.contentX = Math.max(0, root.zoomOnMouse * timeline.scaleFactor - getMouseX())
root.zoomOnMouse = -1 root.zoomOnMouse = -1
} else { } else {
scrollView.contentX = Math.max(0, root.consumerPosition * timeline.scaleFactor - (scrollView.width / 2)) scrollView.contentX = Math.max(0, root.consumerPosition * timeline.scaleFactor - (scrollView.width / 2))
......
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