Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deselect Timeline's item on mouse click #3317

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
84 changes: 57 additions & 27 deletions src/timeline/js/controllers.js
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down