@@ -517,10 +517,12 @@ App.controller("TimelineCtrl", function ($scope) {
517
517
// Trim clip_id
518
518
var id = clip_id . replace ( "clip_" , "" ) ;
519
519
520
- // Clear transitions also (if needed)
521
- if ( id !== "" && clear_selections ) {
522
- $scope . selectTransition ( "" , clear_selections ) ;
523
- $scope . selectEffect ( "" , clear_selections ) ;
520
+ // Is CTRL pressed?
521
+ var is_ctrl = event && event . ctrlKey ;
522
+
523
+ // Clear transitions selection if needed
524
+ if ( id !== "" && clear_selections && ! is_ctrl ) {
525
+ $scope . selectTransition ( "" , true ) ;
524
526
}
525
527
// Call slice method and exit (don't actually select the clip)
526
528
if ( id !== "" && $scope . enable_razor ) {
@@ -531,18 +533,28 @@ App.controller("TimelineCtrl", function ($scope) {
531
533
// Don't actually select clip
532
534
return ;
533
535
}
534
- // Is CTRL pressed?
535
- var is_ctrl = false ;
536
- if ( event && event . ctrlKey ) {
537
- is_ctrl = true ;
538
- }
539
536
540
- // Unselect all clips
537
+ // Update selection for clips
541
538
for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
542
539
if ( $scope . project . clips [ clip_index ] . id === id ) {
543
- $scope . project . clips [ clip_index ] . selected = true ;
544
- if ( $scope . Qt ) {
545
- timeline . addSelection ( id , "clip" , clear_selections ) ;
540
+ // Invert selection if CTRL is pressed and not forced add and already selected
541
+ if ( is_ctrl && clear_selections && ( $scope . project . clips [ clip_index ] . selected === true ) ) {
542
+ $scope . project . clips [ clip_index ] . selected = false ;
543
+ if ( $scope . Qt ) {
544
+ timeline . removeSelection ( $scope . project . clips [ clip_index ] . id , "clip" ) ;
545
+ }
546
+ }
547
+ else {
548
+ $scope . project . clips [ clip_index ] . selected = true ;
549
+ if ( $scope . Qt ) {
550
+ // Do not clear selection if CTRL is pressed
551
+ if ( is_ctrl ) {
552
+ timeline . addSelection ( id , "clip" , false ) ;
553
+ }
554
+ else {
555
+ timeline . addSelection ( id , "clip" , clear_selections ) ;
556
+ }
557
+ }
546
558
}
547
559
}
548
560
else if ( clear_selections && ! is_ctrl ) {
@@ -559,10 +571,12 @@ App.controller("TimelineCtrl", function ($scope) {
559
571
// Trim tran_id
560
572
var id = tran_id . replace ( "transition_" , "" ) ;
561
573
562
- // Clear clips also (if needed)
563
- if ( id !== "" && clear_selections ) {
574
+ // Is CTRL pressed?
575
+ var is_ctrl = event && event . ctrlKey ;
576
+
577
+ // Clear clips selection if needed
578
+ if ( id !== "" && clear_selections && ! is_ctrl ) {
564
579
$scope . selectClip ( "" , true ) ;
565
- $scope . selectEffect ( "" , true ) ;
566
580
}
567
581
// Call slice method and exit (don't actually select the transition)
568
582
if ( id !== "" && $scope . enable_razor ) {
@@ -574,18 +588,27 @@ App.controller("TimelineCtrl", function ($scope) {
574
588
return ;
575
589
}
576
590
577
- // Is CTRL pressed?
578
- var is_ctrl = false ;
579
- if ( event && event . ctrlKey ) {
580
- is_ctrl = true ;
581
- }
582
-
583
- // Unselect all transitions
591
+ // Update selection for transitions
584
592
for ( var tran_index = 0 ; tran_index < $scope . project . effects . length ; tran_index ++ ) {
585
593
if ( $scope . project . effects [ tran_index ] . id === id ) {
586
- $scope . project . effects [ tran_index ] . selected = true ;
587
- if ( $scope . Qt ) {
588
- timeline . addSelection ( id , "transition" , clear_selections ) ;
594
+ // Invert selection if CTRL is pressed and not forced add and already selected
595
+ if ( is_ctrl && clear_selections && ( $scope . project . effects [ tran_index ] . selected === true ) ) {
596
+ $scope . project . effects [ tran_index ] . selected = false ;
597
+ if ( $scope . Qt ) {
598
+ timeline . removeSelection ( $scope . project . effects [ tran_index ] . id , "transition" ) ;
599
+ }
600
+ }
601
+ else {
602
+ $scope . project . effects [ tran_index ] . selected = true ;
603
+ if ( $scope . Qt ) {
604
+ // Do not clear selection if CTRL is pressed
605
+ if ( is_ctrl ) {
606
+ timeline . addSelection ( id , "transition" , false ) ;
607
+ }
608
+ else {
609
+ timeline . addSelection ( id , "transition" , clear_selections ) ;
610
+ }
611
+ }
589
612
}
590
613
}
591
614
else if ( clear_selections && ! is_ctrl ) {
0 commit comments