diff --git a/src/timeline/js/controllers.js b/src/timeline/js/controllers.js index 2668cfcd96..7e861b08d5 100644 --- a/src/timeline/js/controllers.js +++ b/src/timeline/js/controllers.js @@ -472,7 +472,6 @@ App.controller("TimelineCtrl", function ($scope) { $scope.clearAllSelections = function () { // Clear the selections on the main window $scope.selectTransition("", true); - $scope.selectEffect("", true); // Update scope $scope.$apply(function () { @@ -506,11 +505,17 @@ App.controller("TimelineCtrl", function ($scope) { // Trim clip_id var id = clip_id.replace("clip_", ""); - // Clear transitions also (if needed) - if (id !== "" && clear_selections) { - $scope.selectTransition("", clear_selections); - $scope.selectEffect("", clear_selections); + // Is CTRL pressed? + var is_ctrl = false; + if (event && event.ctrlKey) { + is_ctrl = true; + } + + // Clear transitions selection if needed + if (id !== "" && clear_selections && !is_ctrl) { + $scope.selectTransition("", true); } + // Call slice method and exit (don't actually select the clip) if (id !== "" && $scope.enable_razor) { if ($scope.Qt) { @@ -520,18 +525,28 @@ App.controller("TimelineCtrl", function ($scope) { // Don't actually select clip return; } - // Is CTRL pressed? - var is_ctrl = false; - if (event && event.ctrlKey) { - is_ctrl = true; - } - // Unselect all clips + // Update selection for clips for (var clip_index = 0; clip_index < $scope.project.clips.length; clip_index++) { if ($scope.project.clips[clip_index].id === id) { - $scope.project.clips[clip_index].selected = true; - if ($scope.Qt) { - timeline.addSelection(id, "clip", clear_selections); + // Invert selection if CTRL is pressed and not forced add and already selected + if (is_ctrl && clear_selections && ($scope.project.clips[clip_index].selected === true)) { + $scope.project.clips[clip_index].selected = false; + if ($scope.Qt) { + timeline.removeSelection($scope.project.clips[clip_index].id, "clip"); + } + } + else { + $scope.project.clips[clip_index].selected = true; + if ($scope.Qt) { + // Do not clear selection if CTRL is pressed + if (is_ctrl) { + timeline.addSelection(id, "clip", false); + } + else { + timeline.addSelection(id, "clip", clear_selections); + } + } } } else if (clear_selections && !is_ctrl) { @@ -548,11 +563,17 @@ App.controller("TimelineCtrl", function ($scope) { // Trim tran_id var id = tran_id.replace("transition_", ""); - // Clear clips also (if needed) - if (id !== "" && clear_selections) { + // Is CTRL pressed? + var is_ctrl = false; + if (event && event.ctrlKey) { + is_ctrl = true; + } + + // Clear clips selection if needed + if (id !== "" && clear_selections && !is_ctrl) { $scope.selectClip("", true); - $scope.selectEffect("", true); } + // Call slice method and exit (don't actually select the transition) if (id !== "" && $scope.enable_razor) { if ($scope.Qt) { @@ -563,18 +584,27 @@ App.controller("TimelineCtrl", function ($scope) { return; } - // Is CTRL pressed? - var is_ctrl = false; - if (event && event.ctrlKey) { - is_ctrl = true; - } - - // Unselect all transitions + // Update selection for transitions for (var tran_index = 0; tran_index < $scope.project.effects.length; tran_index++) { if ($scope.project.effects[tran_index].id === id) { - $scope.project.effects[tran_index].selected = true; - if ($scope.Qt) { - timeline.addSelection(id, "transition", clear_selections); + // Invert selection if CTRL is pressed and not forced add and already selected + if (is_ctrl && clear_selections && ($scope.project.effects[tran_index].selected === true)) { + $scope.project.effects[tran_index].selected = false; + if ($scope.Qt) { + timeline.removeSelection($scope.project.effects[tran_index].id, "transition"); + } + } + else { + $scope.project.effects[tran_index].selected = true; + if ($scope.Qt) { + // Do not clear selection if CTRL is pressed + if (is_ctrl) { + timeline.addSelection(id, "transition", false); + } + else { + timeline.addSelection(id, "transition", clear_selections); + } + } } } else if (clear_selections && !is_ctrl) {