Skip to content

Commit

Permalink
Fix a regression from #4230, which broke multi-select drag and drop f…
Browse files Browse the repository at this point in the history
…or clips and transitions.
  • Loading branch information
jonoomph committed Aug 22, 2021
1 parent 899b109 commit 39809ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
24 changes: 9 additions & 15 deletions src/timeline/js/directives/clip.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,16 @@ App.directive("tlClip", function ($timeout) {

// Move all other selected clips with this one if we have more than one clip
$(".ui-selected").each(function () {
clip_name = $(this).attr("id");
var newX, newY;
if (move_clips[clip_name] && ( move_clips[clip_name]['top'] && move_clips[clip_name]['left'] )) {
newY = move_clips[clip_name]['top'] + y_offset;
newX = move_clips[clip_name]['left'] + x_offset;
} else {
move_clips[clip_name] = {};
newY = this.style.top + y_offset;
newX = this.style.left + x_offset;
if (move_clips[$(this).attr("id")]) {
let newY = move_clips[$(this).attr("id")]["top"] + y_offset;
let newX = move_clips[$(this).attr("id")]["left"] + x_offset;
//update the clip location in the array
move_clips[$(this).attr("id")]["top"] = newY;
move_clips[$(this).attr("id")]["left"] = newX;
//change the element location
$(this).css("left", newX);
$(this).css("top", newY);
}
//update the clip location in the array
move_clips[$(this).attr("id")]["top"] = newY;
move_clips[$(this).attr("id")]["left"] = newX;
//change the element location
$(this).css("left", newX);
$(this).css("top", newY);
});
},
revert: function (valid) {
Expand Down
26 changes: 9 additions & 17 deletions src/timeline/js/directives/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,24 +278,16 @@ App.directive("tlTransition", function () {

// Move all other selected transitions with this one
$(".ui-selected").each(function () {
transition_name = $(this).attr("id");
var newX, newY;
if (move_clips[transition_name] && ( move_clips[transition_name]['top'] && move_clips[clip_name]['left'] )) {
newY = move_clips[transition_name]['top'] + y_offset;
newX = move_clips[transition_name]['left'] + x_offset;
} else {
// If this transition is not yet in move_clips, add it.
move_clips[transition_name] = {};
newY = this.style.top + y_offset;
newX = this.style.left + x_offset;
if (move_transitions[$(this).attr("id")]) {
let newY = move_transitions[$(this).attr("id")]["top"] + y_offset;
let newX = move_transitions[$(this).attr("id")]["left"] + x_offset;
// Update the transition location in the array
move_transitions[$(this).attr("id")]["top"] = newY;
move_transitions[$(this).attr("id")]["left"] = newX;
// Change the element location
$(this).css("left", newX);
$(this).css("top", newY);
}
// Update the transition location in the array
move_transitions[$(this).attr("id")]["top"] = newY;
move_transitions[$(this).attr("id")]["left"] = newX;
// Change the element location
$(this).css("left", newX);
$(this).css("top", newY);

});

},
Expand Down

0 comments on commit 39809ed

Please sign in to comment.