Commit d64cc5b1 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Disable snapping when pressing Shift while dragging a clip in timeline

Related to #599
parent a0475858
...@@ -379,10 +379,10 @@ Rectangle { ...@@ -379,10 +379,10 @@ Rectangle {
// Don't allow moving composition to an audio track // Don't allow moving composition to an audio track
track = controller.getCompositionTrackId(clipBeingDroppedId) track = controller.getCompositionTrackId(clipBeingDroppedId)
} }
controller.suggestCompositionMove(clipBeingDroppedId, track, frame, root.consumerPosition, Math.floor(root.snapping)) controller.suggestCompositionMove(clipBeingDroppedId, track, frame, root.consumerPosition, root.snapping)
continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY) continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY)
} else if (!controller.isAudioTrack(track)) { } else if (!controller.isAudioTrack(track)) {
frame = controller.suggestSnapPoint(frame, Math.floor(root.snapping)) frame = controller.suggestSnapPoint(frame, root.snapping)
clipBeingDroppedData = drag.getDataAsString('kdenlive/composition') clipBeingDroppedData = drag.getDataAsString('kdenlive/composition')
clipBeingDroppedId = timeline.insertComposition(track, frame, clipBeingDroppedData , false) clipBeingDroppedId = timeline.insertComposition(track, frame, clipBeingDroppedData , false)
continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY) continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY)
...@@ -493,7 +493,7 @@ Rectangle { ...@@ -493,7 +493,7 @@ Rectangle {
// we want insert/overwrite mode, make a fake insert at end of timeline, then move to position // we want insert/overwrite mode, make a fake insert at end of timeline, then move to position
clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, timeline.fullDuration, clipBeingDroppedData) clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, timeline.fullDuration, clipBeingDroppedData)
if (clipBeingDroppedId > -1) { if (clipBeingDroppedId > -1) {
fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, Math.floor(root.snapping)) fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, root.snapping)
fakeTrack = timeline.activeTrack fakeTrack = timeline.activeTrack
} else { } else {
drag.accepted = false drag.accepted = false
...@@ -521,18 +521,18 @@ Rectangle { ...@@ -521,18 +521,18 @@ Rectangle {
timeline.activeTrack = tracksRepeater.itemAt(track).trackInternalId timeline.activeTrack = tracksRepeater.itemAt(track).trackInternalId
var frame = Math.round((drag.x + scrollView.contentX) / timeline.scaleFactor) var frame = Math.round((drag.x + scrollView.contentX) / timeline.scaleFactor)
if (clipBeingDroppedId >= 0) { if (clipBeingDroppedId >= 0) {
fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, Math.floor(root.snapping)) fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, root.snapping)
fakeTrack = timeline.activeTrack fakeTrack = timeline.activeTrack
//controller.requestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, true, false, false) //controller.requestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, true, false, false)
continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY) continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY)
} else { } else {
frame = controller.suggestSnapPoint(frame, Math.floor(root.snapping)) frame = controller.suggestSnapPoint(frame, root.snapping)
if (controller.normalEdit()) { if (controller.normalEdit()) {
clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, frame, drag.getDataAsString('kdenlive/producerslist'), false, true) clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, frame, drag.getDataAsString('kdenlive/producerslist'), false, true)
} else { } else {
// we want insert/overwrite mode, make a fake insert at end of timeline, then move to position // we want insert/overwrite mode, make a fake insert at end of timeline, then move to position
clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, timeline.fullDuration, clipBeingDroppedData) clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, timeline.fullDuration, clipBeingDroppedData)
fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, Math.floor(root.snapping)) fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, root.snapping)
fakeTrack = timeline.activeTrack fakeTrack = timeline.activeTrack
} }
continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY) continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY)
...@@ -580,7 +580,7 @@ Rectangle { ...@@ -580,7 +580,7 @@ Rectangle {
//controller.requestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, true, false, false) //controller.requestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, true, false, false)
continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY) continuousScrolling(drag.x + scrollView.contentX, drag.y + scrollView.contentY)
} else { } else {
frame = controller.suggestSnapPoint(frame, Math.floor(root.snapping)) frame = controller.suggestSnapPoint(frame, root.snapping)
if (controller.normalEdit()) { if (controller.normalEdit()) {
//clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, frame, drag.getDataAsString('kdenlive/producerslist'), false, true) //clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, frame, drag.getDataAsString('kdenlive/producerslist'), false, true)
} else { } else {
...@@ -892,7 +892,7 @@ Rectangle { ...@@ -892,7 +892,7 @@ Rectangle {
// Move group // Move group
var track = controller.getItemTrackId(spacerGroup) var track = controller.getItemTrackId(spacerGroup)
var frame = Math.round((mouse.x + scrollView.contentX) / timeline.scaleFactor) + spacerFrame - spacerClickFrame var frame = Math.round((mouse.x + scrollView.contentX) / timeline.scaleFactor) + spacerFrame - spacerClickFrame
frame = controller.suggestItemMove(spacerGroup, track, frame, root.consumerPosition, Math.floor(root.snapping)) frame = controller.suggestItemMove(spacerGroup, track, frame, root.consumerPosition, root.snapping)
continuousScrolling(mouse.x + scrollView.contentX, mouse.y + scrollView.contentY) continuousScrolling(mouse.x + scrollView.contentX, mouse.y + scrollView.contentY)
} }
scim = true scim = true
...@@ -1121,7 +1121,7 @@ Rectangle { ...@@ -1121,7 +1121,7 @@ Rectangle {
} }
} }
if (dragProxy.isComposition) { if (dragProxy.isComposition) {
dragFrame = controller.suggestCompositionMove(dragProxy.draggedItem, tId, posx, root.consumerPosition, Math.floor(root.snapping)) dragFrame = controller.suggestCompositionMove(dragProxy.draggedItem, tId, posx, root.consumerPosition, (mouse.modifiers & Qt.ShiftModifier) ? 0 : root.snapping)
timeline.activeTrack = timeline.getItemMovingTrack(dragProxy.draggedItem) timeline.activeTrack = timeline.getItemMovingTrack(dragProxy.draggedItem)
} else { } else {
if (!controller.normalEdit() && dragProxy.masterObject.parent != dragContainer) { if (!controller.normalEdit() && dragProxy.masterObject.parent != dragContainer) {
...@@ -1132,7 +1132,7 @@ Rectangle { ...@@ -1132,7 +1132,7 @@ Rectangle {
dragProxy.masterObject.y = pos.y dragProxy.masterObject.y = pos.y
//console.log('bringing item to front') //console.log('bringing item to front')
} }
dragFrame = controller.suggestClipMove(dragProxy.draggedItem, tId, posx, root.consumerPosition, Math.floor(root.snapping), moveMirrorTracks) dragFrame = controller.suggestClipMove(dragProxy.draggedItem, tId, posx, root.consumerPosition, (mouse.modifiers & Qt.ShiftModifier) ? 0 : root.snapping, moveMirrorTracks)
timeline.activeTrack = timeline.getItemMovingTrack(dragProxy.draggedItem) timeline.activeTrack = timeline.getItemMovingTrack(dragProxy.draggedItem)
} }
var delta = dragFrame - dragProxy.sourceFrame var delta = dragFrame - dragProxy.sourceFrame
......
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