Fix corruption when clicking in timeline after undo or clip offset correction

parent 0803d6ed
......@@ -70,6 +70,7 @@ Rectangle {
property double speed: 1.0
property color borderColor: 'black'
property bool forceReloadThumb
property bool isComposition: false
width : clipDuration * timeScale;
opacity: dragProxyArea.drag.active && dragProxy.draggedItem == clipId ? 0.8 : 1.0
......@@ -87,7 +88,8 @@ Rectangle {
function clearAndMove(offset) {
controller.requestClearSelection()
controller.requestClipMove(clipRoot.clipId, clipRoot.trackId, clipRoot.modelStart - offset, true, true, true);
controller.requestClipMove(clipRoot.clipId, clipRoot.trackId, clipRoot.modelStart - offset, true, true, true)
controller.requestAddToSelection(clipRoot.clipId)
}
onInPointChanged: {
......
......@@ -52,6 +52,7 @@ Item {
property int aTrack: -1
property int clipId //Id of the clip in the model
property int originalTrackId: trackId
property bool isComposition: true
property int originalX: x
property int originalDuration: clipDuration
property int lastValidDuration: clipDuration
......
......@@ -71,8 +71,8 @@ function getTrackIndexFromId(id) {
function getTrackById(id) {
var i = 0;
for (; i < trackHeaderRepeater.count; i++) {
if (trackHeaderRepeater.itemAt(i).trackId == id) {
for (; i < tracksRepeater.count; i++) {
if (tracksRepeater.itemAt(i).trackInternalId == id) {
return tracksRepeater.itemAt(i);
}
}
......
......@@ -1021,8 +1021,8 @@ Rectangle {
property bool isComposition
property int verticalOffset
property var masterObject
color: 'green'
opacity: 0.8
color: 'transparent'
//opacity: 0.8
MouseArea {
id: dragProxyArea
anchors.fill: parent
......@@ -1068,11 +1068,23 @@ Rectangle {
var posx = Math.round((parent.x)/ root.timeScale)
var clickAccepted = true
if (controller.normalEdit() && (tk != Logic.getTrackIdFromPos(parent.y) || x != posx)) {
console.log('INCORRECT DRAG, Trying to recover item: ', parent.y,' XPOS: ',x,'=',posx,'\n!!!!!!!!!!')
console.log('INCORRECT DRAG, Trying to recover item: ', parent.y,' XPOS: ',x,'=',posx,'on track: ',tk ,'\n!!!!!!!!!!')
// Try to find correct item
var track = Logic.getTrackById(tk)
var container = track.children[0].children[0].children[0]
var tentativeClip = container.childAt(mouseX + parent.x, 5)
var container = track.children[0]
var tentativeClip = undefined
var realX = mouseX + parent.x
for (var i = 0 ; i < container.children.length; i++) {
if (container.children[i].children.length == 0 || container.children[i].children[0].children.length == 0) {
continue
}
var testX = container.children[i].children[0].children[0].x - realX
if (dragProxy.isComposition == container.children[i].children[0].children[0].isComposition && testX < 0 && testX + container.children[i].children[0].children[0].width > 0) {
// Found clip in place
tentativeClip = container.children[i].children[0].children[0]
break
}
}
if (tentativeClip && tentativeClip.clipId) {
clickAccepted = true
dragProxy.draggedItem = tentativeClip.clipId
......@@ -1089,6 +1101,7 @@ Rectangle {
mouse.accepted = false
dragProxy.draggedItem = -1
dragProxy.masterObject = undefined
dragProxy.sourceFrame = -1
parent.x = 0
parent.y = 0
parent.width = 0
......
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