Changeset View
Changeset View
Standalone View
Standalone View
src/timeline2/view/qml/timeline.qml
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 68 | function zoomByWheel(wheel) { | |||
---|---|---|---|---|---|
69 | if (wheel.modifiers & Qt.AltModifier) { | 69 | if (wheel.modifiers & Qt.AltModifier) { | ||
70 | // Seek to next snap | 70 | // Seek to next snap | ||
71 | if (wheel.angleDelta.x > 0) { | 71 | if (wheel.angleDelta.x > 0) { | ||
72 | timeline.triggerAction('monitor_seek_snap_backward') | 72 | timeline.triggerAction('monitor_seek_snap_backward') | ||
73 | } else { | 73 | } else { | ||
74 | timeline.triggerAction('monitor_seek_snap_forward') | 74 | timeline.triggerAction('monitor_seek_snap_forward') | ||
75 | } | 75 | } | ||
76 | } else if (wheel.modifiers & Qt.ControlModifier) { | 76 | } else if (wheel.modifiers & Qt.ControlModifier) { | ||
77 | root.wheelAccumulatedDelta += wheel.angleDelta.y; | ||||
77 | // Zoom | 78 | // Zoom | ||
78 | if (wheel.angleDelta.y > 0) { | 79 | if (root.wheelAccumulatedDelta >= defaultDeltasPerStep) { | ||
79 | root.zoomIn(true); | 80 | root.zoomIn(true); | ||
80 | } else { | 81 | root.wheelAccumulatedDelta = 0; | ||
82 | } else if (root.wheelAccumulatedDelta <= -defaultDeltasPerStep) { | ||||
81 | root.zoomOut(true); | 83 | root.zoomOut(true); | ||
84 | root.wheelAccumulatedDelta = 0; | ||||
82 | } | 85 | } | ||
83 | } else if (wheel.modifiers & Qt.ShiftModifier) { | 86 | } else if (wheel.modifiers & Qt.ShiftModifier) { | ||
84 | // Vertical scroll | 87 | // Vertical scroll | ||
85 | var newScroll = Math.min(scrollView.flickableItem.contentY - wheel.angleDelta.y, trackHeaders.height - tracksArea.height + scrollView.__horizontalScrollBar.height + cornerstone.height) | 88 | var newScroll = Math.min(scrollView.flickableItem.contentY - wheel.angleDelta.y, trackHeaders.height - tracksArea.height + scrollView.__horizontalScrollBar.height + cornerstone.height) | ||
86 | scrollView.flickableItem.contentY = Math.max(newScroll, 0) | 89 | scrollView.flickableItem.contentY = Math.max(newScroll, 0) | ||
87 | } else { | 90 | } else { | ||
88 | // Horizontal scroll | 91 | // Horizontal scroll | ||
89 | var newScroll = Math.min(scrollView.flickableItem.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - (scrollView.width - scrollView.__verticalScrollBar.width)) | 92 | var newScroll = Math.min(scrollView.flickableItem.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - (scrollView.width - scrollView.__verticalScrollBar.width)) | ||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | |||||
226 | property int spacerClickFrame: -1 | 229 | property int spacerClickFrame: -1 | ||
227 | property real timeScale: timeline.scaleFactor | 230 | property real timeScale: timeline.scaleFactor | ||
228 | property real snapping: timeline.snap ? 10 / Math.sqrt(timeScale) - 0.5 : -1 | 231 | property real snapping: timeline.snap ? 10 / Math.sqrt(timeScale) - 0.5 : -1 | ||
229 | property var timelineSelection: timeline.selection | 232 | property var timelineSelection: timeline.selection | ||
230 | property int trackHeight | 233 | property int trackHeight | ||
231 | property int copiedClip: -1 | 234 | property int copiedClip: -1 | ||
232 | property int zoomOnMouse: -1 | 235 | property int zoomOnMouse: -1 | ||
233 | property int viewActiveTrack: timeline.activeTrack | 236 | property int viewActiveTrack: timeline.activeTrack | ||
237 | property int wheelAccumulatedDelta: 0 | ||||
238 | readonly property int defaultDeltasPerStep: 120 | ||||
234 | 239 | | |||
235 | //onCurrentTrackChanged: timeline.selection = [] | 240 | //onCurrentTrackChanged: timeline.selection = [] | ||
236 | onTimeScaleChanged: { | 241 | onTimeScaleChanged: { | ||
237 | if (root.zoomOnMouse >= 0) { | 242 | if (root.zoomOnMouse >= 0) { | ||
238 | scrollView.flickableItem.contentX = Math.max(0, root.zoomOnMouse * timeline.scaleFactor - tracksArea.mouseX) | 243 | scrollView.flickableItem.contentX = Math.max(0, root.zoomOnMouse * timeline.scaleFactor - tracksArea.mouseX) | ||
239 | root.zoomOnMouse = -1 | 244 | root.zoomOnMouse = -1 | ||
240 | } else { | 245 | } else { | ||
241 | scrollView.flickableItem.contentX = Math.max(0, (timeline.seekPosition > -1 ? timeline.seekPosition : timeline.position) * timeline.scaleFactor - (scrollView.width / 2)) | 246 | scrollView.flickableItem.contentX = Math.max(0, (timeline.seekPosition > -1 ? timeline.seekPosition : timeline.position) * timeline.scaleFactor - (scrollView.width / 2)) | ||
▲ Show 20 Lines • Show All 1245 Lines • Show Last 20 Lines |