Skip to content

Commit 5a505d1

Browse files
authored
Merge pull request #4335 from OpenShot/fix-reggresion-clip-move
Fix a regression in multi-drag for Clips/Transitions
2 parents ed0e8c5 + 5f19032 commit 5a505d1

File tree

3 files changed

+18
-33
lines changed

3 files changed

+18
-33
lines changed

src/timeline/js/controllers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,6 @@ App.controller("TimelineCtrl", function ($scope) {
13971397
// Re-index Layer Y values
13981398
$scope.updateLayerIndex();
13991399
}
1400-
$scope.$digest();
14011400
}
14021401
// return true
14031402
return true;

src/timeline/js/directives/clip.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -330,22 +330,16 @@ App.directive("tlClip", function ($timeout) {
330330

331331
// Move all other selected clips with this one if we have more than one clip
332332
$(".ui-selected").each(function () {
333-
clip_name = $(this).attr("id");
334-
var newX, newY;
335-
if (move_clips[clip_name] && ( move_clips[clip_name]['top'] && move_clips[clip_name]['left'] )) {
336-
newY = move_clips[clip_name]['top'] + y_offset;
337-
newX = move_clips[clip_name]['left'] + x_offset;
338-
} else {
339-
move_clips[clip_name] = {};
340-
newY = this.style.top + y_offset;
341-
newX = this.style.left + x_offset;
333+
if (move_clips[$(this).attr("id")]) {
334+
let newY = move_clips[$(this).attr("id")]["top"] + y_offset;
335+
let newX = move_clips[$(this).attr("id")]["left"] + x_offset;
336+
//update the clip location in the array
337+
move_clips[$(this).attr("id")]["top"] = newY;
338+
move_clips[$(this).attr("id")]["left"] = newX;
339+
//change the element location
340+
$(this).css("left", newX);
341+
$(this).css("top", newY);
342342
}
343-
//update the clip location in the array
344-
move_clips[$(this).attr("id")]["top"] = newY;
345-
move_clips[$(this).attr("id")]["left"] = newX;
346-
//change the element location
347-
$(this).css("left", newX);
348-
$(this).css("top", newY);
349343
});
350344
},
351345
revert: function (valid) {

src/timeline/js/directives/transition.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,24 +278,16 @@ App.directive("tlTransition", function () {
278278

279279
// Move all other selected transitions with this one
280280
$(".ui-selected").each(function () {
281-
transition_name = $(this).attr("id");
282-
var newX, newY;
283-
if (move_clips[transition_name] && ( move_clips[transition_name]['top'] && move_clips[clip_name]['left'] )) {
284-
newY = move_clips[transition_name]['top'] + y_offset;
285-
newX = move_clips[transition_name]['left'] + x_offset;
286-
} else {
287-
// If this transition is not yet in move_clips, add it.
288-
move_clips[transition_name] = {};
289-
newY = this.style.top + y_offset;
290-
newX = this.style.left + x_offset;
281+
if (move_transitions[$(this).attr("id")]) {
282+
let newY = move_transitions[$(this).attr("id")]["top"] + y_offset;
283+
let newX = move_transitions[$(this).attr("id")]["left"] + x_offset;
284+
// Update the transition location in the array
285+
move_transitions[$(this).attr("id")]["top"] = newY;
286+
move_transitions[$(this).attr("id")]["left"] = newX;
287+
// Change the element location
288+
$(this).css("left", newX);
289+
$(this).css("top", newY);
291290
}
292-
// Update the transition location in the array
293-
move_transitions[$(this).attr("id")]["top"] = newY;
294-
move_transitions[$(this).attr("id")]["left"] = newX;
295-
// Change the element location
296-
$(this).css("left", newX);
297-
$(this).css("top", newY);
298-
299291
});
300292

301293
},

0 commit comments

Comments
 (0)