Commit cbee271e authored by Sashmita Raghav's avatar Sashmita Raghav
Browse files

Fix subtitle clip duration updation during subtitle resizing

parent 3e111f51
...@@ -1469,7 +1469,7 @@ Rectangle { ...@@ -1469,7 +1469,7 @@ Rectangle {
property double oldStartFrame: subtitleBase.x property double oldStartFrame: subtitleBase.x
Rectangle { Rectangle {
id: subtitleBase id: subtitleBase
width: duration * timeScale width: duration * timeScale // to make width change wrt timeline scale factor
height: tracksContainer.height height: tracksContainer.height
x: model.startframe * timeScale; x: model.startframe * timeScale;
/*Text { /*Text {
...@@ -1529,6 +1529,7 @@ Rectangle { ...@@ -1529,6 +1529,7 @@ Rectangle {
property int newStart: -1 property int newStart: -1
property int diff: -1 property int diff: -1
property double delta: -1 property double delta: -1
property double oldDelta: 0
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.SizeHorCursor cursorShape: Qt.SizeHorCursor
drag.target: leftstart drag.target: leftstart
...@@ -1539,7 +1540,7 @@ Rectangle { ...@@ -1539,7 +1540,7 @@ Rectangle {
root.autoScrolling = false root.autoScrolling = false
//rightend.anchors.right = undefined //rightend.anchors.right = undefined
oldStartX = mouseX oldStartX = mouseX
oldStartFrame = subtitleBase.x oldStartFrame = subtitleBase.x // the original start frame of subtitle
console.log(oldStartFrame) console.log(oldStartFrame)
console.log(subtitleBase.x) console.log(subtitleBase.x)
...@@ -1555,11 +1556,14 @@ Rectangle { ...@@ -1555,11 +1556,14 @@ Rectangle {
diff = (mouseX - oldStartX) / timeScale diff = (mouseX - oldStartX) / timeScale
subtitleBase.x = subtitleBase.x + diff subtitleBase.x = subtitleBase.x + diff
console.log("oldStartFrame",oldStartFrame/timeline.scaleFactor,"subtitleBase",subtitleBase.x/timeline.scaleFactor) console.log("oldStartFrame",oldStartFrame/timeline.scaleFactor,"subtitleBase",subtitleBase.x/timeline.scaleFactor)
console.log("duration:", duration) console.log("Duration:", duration)
delta = subtitleBase.x/timeline.scaleFactor - oldStartFrame/timeline.scaleFactor delta = subtitleBase.x/timeline.scaleFactor - oldStartFrame/timeline.scaleFactor
console.log("Diff:",diff,"Delta:", delta) var diffDelta = delta - oldDelta //update the change in start frame differece
console.log("new duration =", subtitleBase.width/timeScale - delta ) oldDelta = delta
//timeline.moveSubtitle(oldStartX/ timeScale, subtitleBase.x/timeline.scaleFactor) //console.log("Diff:",diff,"Delta:", delta, "Delta_Diff",diffDelta)
console.log("New duration =", subtitleBase.width/timeScale - delta )
duration = duration - diffDelta //update duration to enable resizing
//console.log("Delta duration =", duration )
} }
} }
} }
...@@ -1574,7 +1578,6 @@ Rectangle { ...@@ -1574,7 +1578,6 @@ Rectangle {
} }
} }
} }
} }
Rectangle { Rectangle {
// end position resize handle // end position resize handle
......
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