Commit 805479f0 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Timeline: Implement basic linked clips resizing

parent b9a12692
...@@ -57,7 +57,12 @@ Rectangle { ...@@ -57,7 +57,12 @@ Rectangle {
function resize() { function resize() {
// This function updates Backend // This function updates Backend
workflow.resizeClip( uuid, begin, end, position ) var _length = selectedClips.length;
for ( var i = _length - 1; i >= 0; --i ) {
if ( selectedClips[i] ) {
workflow.resizeClip( selectedClips[i].uuid, begin, end, position );
}
}
} }
function selectLinkedClip() { function selectLinkedClip() {
...@@ -82,6 +87,21 @@ Rectangle { ...@@ -82,6 +87,21 @@ Rectangle {
thumbnailSource = "image://thumbnail/" + libraryUuid + "/" + pos; thumbnailSource = "image://thumbnail/" + libraryUuid + "/" + pos;
} }
function resizeLinkedClips( oldPos, oldBegin, oldEnd ) {
if ( !linkedClip )
return;
var lc = findClipItem( linkedClip );
if ( lc === null )
return;
// Don't resize from the begining if the clips didn't shared the same begin position
if ( lc.position === oldPos ) {
lc.position = position;
lc.begin = begin;
}
if ( lc.end === oldEnd )
lc.end = end;
}
onXChanged: { onXChanged: {
if ( sView.width - initPosOfCursor < width ) if ( sView.width - initPosOfCursor < width )
return; return;
...@@ -268,6 +288,9 @@ Rectangle { ...@@ -268,6 +288,9 @@ Rectangle {
if ( dragArea.pressed === true ) { if ( dragArea.pressed === true ) {
// Handle resizing // Handle resizing
if ( resizing === true ) { if ( resizing === true ) {
var oldPos = position;
var oldBegin = begin;
var oldEnd = end;
if ( mouseX < width / 2 ) { if ( mouseX < width / 2 ) {
var newPos = position + ptof( mouseX ); var newPos = position + ptof( mouseX );
var newBegin = begin + ptof( mouseX ); var newBegin = begin + ptof( mouseX );
...@@ -282,6 +305,7 @@ Rectangle { ...@@ -282,6 +305,7 @@ Rectangle {
return; return;
end = newEnd; end = newEnd;
} }
resizeLinkedClips(oldPos, oldBegin, oldEnd);
} }
} }
else { else {
......
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