@@ -331,18 +331,20 @@ App.controller('TimelineCtrl',function($scope) {
331
331
}
332
332
// Determine if this property is a Keyframe
333
333
if ( typeof object [ child ] == "object" && "Points" in object [ child ] ) {
334
- for ( const point of object [ child ] . Points ) {
335
- if ( point . co . X >= clip_start_x && point . co . X <= clip_end_x )
334
+ for ( var point = 0 ; point < object [ child ] . Points . length ; point ++ ) {
335
+ var co = object [ child ] . Points [ point ] . co ;
336
+ if ( co . X >= clip_start_x && co . X <= clip_end_x )
336
337
// Only add keyframe coordinates that are within the bounds of the clip
337
- keyframes [ point . co . X ] = point . co . Y ;
338
+ keyframes [ co . X ] = co . Y ;
338
339
}
339
340
}
340
341
// Determine if this property is a Color Keyframe
341
342
if ( typeof object [ child ] == "object" && "red" in object [ child ] ) {
342
- for ( const point of object [ child ] [ "red" ] . Points ) {
343
- if ( point . co . X >= clip_start_x && point . co . X <= clip_end_x )
343
+ for ( var point = 0 ; point < object [ child ] [ "red" ] . Points . length ; point ++ ) {
344
+ var co = object [ child ] [ "red" ] . Points [ point ] . co ;
345
+ if ( co . X >= clip_start_x && co . X <= clip_end_x )
344
346
// Only add keyframe coordinates that are within the bounds of the clip
345
- keyframes [ point . co . X ] = point . co . Y ;
347
+ keyframes [ co . X ] = co . Y ;
346
348
}
347
349
}
348
350
}
@@ -357,18 +359,20 @@ App.controller('TimelineCtrl',function($scope) {
357
359
}
358
360
// Determine if this property is a Keyframe
359
361
if ( typeof object [ "effects" ] [ effect ] [ child ] == "object" && "Points" in object [ "effects" ] [ effect ] [ child ] ) {
360
- for ( const point of object [ "effects" ] [ effect ] [ child ] . Points ) {
361
- if ( point . co . X >= clip_start_x && point . co . X <= clip_end_x )
362
+ for ( var point = 0 ; point < object [ "effects" ] [ effect ] [ child ] . Points . length ; point ++ ) {
363
+ var co = object [ "effects" ] [ effect ] [ child ] . Points [ point ] . co ;
364
+ if ( co . X >= clip_start_x && co . X <= clip_end_x )
362
365
// Only add keyframe coordinates that are within the bounds of the clip
363
- keyframes [ point . co . X ] = point . co . Y ;
366
+ keyframes [ co . X ] = co . Y ;
364
367
}
365
368
}
366
369
// Determine if this property is a Color Keyframe
367
370
if ( typeof object [ "effects" ] [ effect ] [ child ] == "object" && "red" in object [ "effects" ] [ effect ] [ child ] ) {
368
- for ( const point of object [ "effects" ] [ effect ] [ child ] [ "red" ] . Points ) {
369
- if ( point . co . X >= clip_start_x && point . co . X <= clip_end_x )
371
+ for ( var point = 0 ; point < object [ "effects" ] [ effect ] [ child ] [ "red" ] . Points . length ; point ++ ) {
372
+ var co = object [ "effects" ] [ effect ] [ child ] [ "red" ] . Points [ point ] . co ;
373
+ if ( co . X >= clip_start_x && co . X <= clip_end_x )
370
374
// Only add keyframe coordinates that are within the bounds of the clip
371
- keyframes [ point . co . X ] = point . co . Y ;
375
+ keyframes [ co . X ] = co . Y ;
372
376
}
373
377
}
374
378
}
@@ -470,12 +474,12 @@ App.controller('TimelineCtrl',function($scope) {
470
474
// Set the audio data for a clip
471
475
$scope . setAudioData = function ( clip_id , audio_data ) {
472
476
// Find matching clip
473
- for ( const clip of $scope . project . clips ) {
474
- if ( clip . id == clip_id ) {
477
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
478
+ if ( $scope . project . clips [ clip_index ] . id == clip_id ) {
475
479
// Set audio data
476
480
$scope . $apply ( function ( ) {
477
- clip . audio_data = audio_data ;
478
- clip . show_audio = true ;
481
+ $scope . project . clips [ clip_index ] . audio_data = audio_data ;
482
+ $scope . project . clips [ clip_index ] . show_audio = true ;
479
483
} ) ;
480
484
timeline . qt_log ( "Audio data successful set on clip JSON" ) ;
481
485
break ;
@@ -489,12 +493,12 @@ App.controller('TimelineCtrl',function($scope) {
489
493
// Hide the audio waveform for a clip
490
494
$scope . hideAudioData = function ( clip_id , audio_data ) {
491
495
// Find matching clip
492
- for ( const clip of $scope . project . clips ) {
493
- if ( clip . id == clip_id ) {
496
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
497
+ if ( $scope . project . clips [ clip_index ] . id == clip_id ) {
494
498
// Set audio data
495
499
$scope . $apply ( function ( ) {
496
- clip . show_audio = false ;
497
- clip . audio_data = [ ] ;
500
+ $scope . project . clips [ clip_index ] . show_audio = false ;
501
+ $scope . project . clips [ clip_index ] . audio_data = [ ] ;
498
502
} ) ;
499
503
break ;
500
504
}
@@ -504,19 +508,19 @@ App.controller('TimelineCtrl',function($scope) {
504
508
// Redraw all audio waveforms on the timeline (if any)
505
509
$scope . reDrawAllAudioData = function ( ) {
506
510
// Find matching clip
507
- for ( const clip of $scope . project . clips ) {
508
- if ( "audio_data" in clip && clip . audio_data . length > 0 ) {
511
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
512
+ if ( "audio_data" in $scope . project . clips [ clip_index ] && $scope . project . clips [ clip_index ] . audio_data . length > 0 ) {
509
513
// Redraw audio data (since it has audio data)
510
- drawAudio ( $scope , clip . id ) ;
514
+ drawAudio ( $scope , $scope . project . clips [ clip_index ] . id ) ;
511
515
}
512
516
}
513
517
} ;
514
518
515
519
// Does clip have audio_data?
516
520
$scope . hasAudioData = function ( clip_id ) {
517
521
// Find matching clip
518
- for ( const clip of $scope . project . clips ) {
519
- if ( clip . id == clip_id && "audio_data" in clip && clip . audio_data . length > 0 ) {
522
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
523
+ if ( $scope . project . clips [ clip_index ] . id == clip_id && "audio_data" in $scope . project . clips [ clip_index ] && $scope . project . clips [ clip_index ] . audio_data . length > 0 ) {
520
524
return true ;
521
525
break ;
522
526
}
@@ -633,11 +637,11 @@ App.controller('TimelineCtrl',function($scope) {
633
637
634
638
// Update scope
635
639
$scope . $apply ( function ( ) {
636
- for ( const clip of $scope . project . clips ) {
637
- clip . selected = false ;
640
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
641
+ $scope . project . clips [ clip_index ] . selected = false ;
638
642
}
639
- for ( const effect of $scope . project . effects ) {
640
- effect . selected = false ;
643
+ for ( var effect_index = 0 ; effect_index < $scope . project . effects . length ; effect_index ++ ) {
644
+ $scope . project . effects [ effect_index ] . selected = false ;
641
645
}
642
646
} ) ;
643
647
} ;
@@ -646,14 +650,14 @@ App.controller('TimelineCtrl',function($scope) {
646
650
$scope . SelectAll = function ( ) {
647
651
$scope . $apply ( function ( ) {
648
652
// Select all clips
649
- for ( const clip of $scope . project . clips ) {
650
- clip . selected = true ;
651
- timeline . addSelection ( clip . id , "clip" , false ) ;
653
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
654
+ $scope . project . clips [ clip_index ] . selected = true ;
655
+ timeline . addSelection ( $scope . project . clips [ clip_index ] . id , "clip" , false ) ;
652
656
}
653
657
// Select all transitions
654
- for ( const effect of $scope . project . effects ) {
655
- effect . selected = true ;
656
- timeline . addSelection ( effect . id , "transition" , false ) ;
658
+ for ( var effect_index = 0 ; effect_index < $scope . project . effects . length ; effect_index ++ ) {
659
+ $scope . project . effects [ effect_index ] . selected = true ;
660
+ timeline . addSelection ( $scope . project . effects [ effect_index ] . id , "transition" , false ) ;
657
661
}
658
662
} ) ;
659
663
} ;
@@ -684,17 +688,17 @@ App.controller('TimelineCtrl',function($scope) {
684
688
}
685
689
686
690
// Unselect all clips
687
- for ( const clip of $scope . project . clips ) {
688
- if ( clip . id == id ) {
689
- clip . selected = true ;
691
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
692
+ if ( $scope . project . clips [ clip_index ] . id == id ) {
693
+ $scope . project . clips [ clip_index ] . selected = true ;
690
694
if ( $scope . Qt ) {
691
695
timeline . addSelection ( id , "clip" , clear_selections ) ;
692
696
}
693
697
}
694
698
else if ( clear_selections && ! is_ctrl ) {
695
- clip . selected = false ;
699
+ $scope . project . clips [ clip_index ] . selected = false ;
696
700
if ( $scope . Qt ) {
697
- timeline . removeSelection ( clip . id , "clip" ) ;
701
+ timeline . removeSelection ( $scope . project . clips [ clip_index ] . id , "clip" ) ;
698
702
}
699
703
}
700
704
}
@@ -727,16 +731,16 @@ App.controller('TimelineCtrl',function($scope) {
727
731
}
728
732
729
733
// Unselect all transitions
730
- for ( const tran of $scope . project . effects ) {
731
- if ( tran . id == id ) {
732
- tran . selected = true ;
734
+ for ( var tran_index = 0 ; tran_index < $scope . project . effects . length ; tran_index ++ ) {
735
+ if ( $scope . project . effects [ tran_index ] . id == id ) {
736
+ $scope . project . effects [ tran_index ] . selected = true ;
733
737
if ( $scope . Qt )
734
738
timeline . addSelection ( id , "transition" , clear_selections ) ;
735
739
}
736
740
else if ( clear_selections && ! is_ctrl ) {
737
- tran . selected = false ;
741
+ $scope . project . effects [ tran_index ] . selected = false ;
738
742
if ( $scope . Qt )
739
- timeline . removeSelection ( tran . id , "transition" ) ;
743
+ timeline . removeSelection ( $scope . project . effects [ tran_index ] . id , "transition" ) ;
740
744
}
741
745
}
742
746
} ;
@@ -758,7 +762,8 @@ App.controller('TimelineCtrl',function($scope) {
758
762
$scope . ResizeTimeline = function ( ) {
759
763
// Unselect all clips
760
764
var furthest_right_edge = 0 ;
761
- for ( const clip of $scope . project . clips ) {
765
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
766
+ var clip = $scope . project . clips [ clip_index ] ;
762
767
var right_edge = clip . position + ( clip . end - clip . start ) ;
763
768
if ( right_edge > furthest_right_edge )
764
769
furthest_right_edge = right_edge ;
@@ -948,20 +953,20 @@ $scope.SetTrackLabel = function (label) {
948
953
// Select new clip object (and unselect others)
949
954
// This needs to be done inline due to async issues with the
950
955
// above calls to SelectClip/SelectTransition
951
- for ( const clip of $scope . project . clips ) {
952
- if ( clip . id == item_id ) {
953
- clip . selected = true ;
956
+ for ( var clip_index = 0 ; clip_index < $scope . project . clips . length ; clip_index ++ ) {
957
+ if ( $scope . project . clips [ clip_index ] . id == item_id ) {
958
+ $scope . project . clips [ clip_index ] . selected = true ;
954
959
} else {
955
- clip . selected = false ;
960
+ $scope . project . clips [ clip_index ] . selected = false ;
956
961
}
957
962
}
958
963
959
964
// Select new transition object (and unselect others)
960
- for ( const tran of $scope . project . effects ) {
961
- if ( tran . id == item_id ) {
962
- tran . selected = true ;
965
+ for ( var tran_index = 0 ; tran_index < $scope . project . effects . length ; tran_index ++ ) {
966
+ if ( $scope . project . effects [ tran_index ] . id == item_id ) {
967
+ $scope . project . effects [ tran_index ] . selected = true ;
963
968
} else {
964
- tran . selected = false ;
969
+ $scope . project . effects [ tran_index ] . selected = false ;
965
970
}
966
971
}
967
972
@@ -1019,7 +1024,9 @@ $scope.SetTrackLabel = function (label) {
1019
1024
}
1020
1025
// Loop through each layer (looking for the closest track based on Y coordinate)
1021
1026
bounding_box . track_position = 0 ;
1022
- for ( const layer of $scope . project . layers ) {
1027
+ for ( var layer_index = $scope . project . layers . length - 1 ; layer_index >= 0 ; layer_index -- ) {
1028
+ var layer = $scope . project . layers [ layer_index ] ;
1029
+
1023
1030
// Compare position of track to Y param (for unlocked tracks)
1024
1031
if ( ! layer . lock ) {
1025
1032
if ( ( top < layer . y && top > bounding_box . track_position ) || bounding_box . track_position === 0 ) {
@@ -1049,7 +1056,9 @@ $scope.SetTrackLabel = function (label) {
1049
1056
1050
1057
$scope . $apply ( function ( ) {
1051
1058
// Loop through each layer
1052
- for ( const layer of $scope . project . layers ) {
1059
+ for ( var layer_index = 0 ; layer_index < $scope . project . layers . length ; layer_index ++ ) {
1060
+ var layer = $scope . project . layers [ layer_index ] ;
1061
+
1053
1062
// Find element on screen (bound to this layer)
1054
1063
var layer_elem = $ ( "#track_" + layer . number ) ;
1055
1064
if ( layer_elem ) {
@@ -1118,7 +1127,9 @@ $scope.SetTrackLabel = function (label) {
1118
1127
var original_right = original_clip . position + ( original_clip . end - original_clip . start ) ;
1119
1128
1120
1129
// Search through all other clips on this track, and look for overlapping ones
1121
- for ( const clip of $scope . project . clips ) {
1130
+ for ( var index = 0 ; index < $scope . project . clips . length ; index ++ ) {
1131
+ var clip = $scope . project . clips [ index ] ;
1132
+
1122
1133
// skip clips that are not on the same layer
1123
1134
if ( original_clip . layer != clip . layer ) {
1124
1135
continue ;
@@ -1146,7 +1157,9 @@ $scope.SetTrackLabel = function (label) {
1146
1157
}
1147
1158
// Search through all existing transitions, and don't overlap an existing one
1148
1159
if ( transition_size != null ) {
1149
- for ( const tran of $scope . project . effects ) {
1160
+ for ( var tran_index = 0 ; tran_index < $scope . project . effects . length ; tran_index ++ ) {
1161
+ var tran = $scope . project . effects [ tran_index ] ;
1162
+
1150
1163
// skip transitions that are not on the same layer
1151
1164
if ( tran . layer != transition_size . layer ) {
1152
1165
continue ;
@@ -1179,9 +1192,12 @@ $scope.SetTrackLabel = function (label) {
1179
1192
var diffs = [ ] ;
1180
1193
1181
1194
// Loop through each pixel position (supports multiple positions: i.e. left and right side of bounding box)
1182
- for ( const position of pixel_positions ) {
1195
+ for ( var pos_index = 0 ; pos_index < pixel_positions . length ; pos_index ++ ) {
1196
+ var position = pixel_positions [ pos_index ] ;
1197
+
1183
1198
// Add clip positions to array
1184
- for ( const clip of $scope . project . clips ) {
1199
+ for ( var index = 0 ; index < $scope . project . clips . length ; index ++ ) {
1200
+ var clip = $scope . project . clips [ index ] ;
1185
1201
var clip_left_position = clip . position * $scope . pixelsPerSecond ;
1186
1202
var clip_right_position = ( clip . position + ( clip . end - clip . start ) ) * $scope . pixelsPerSecond ;
1187
1203
@@ -1195,7 +1211,8 @@ $scope.SetTrackLabel = function (label) {
1195
1211
}
1196
1212
1197
1213
// Add transition positions to array
1198
- for ( const transition of $scope . project . effects ) {
1214
+ for ( var index = 0 ; index < $scope . project . effects . length ; index ++ ) {
1215
+ var transition = $scope . project . effects [ index ] ;
1199
1216
var tran_left_position = transition . position * $scope . pixelsPerSecond ;
1200
1217
var tran_right_position = ( transition . position + ( transition . end - transition . start ) ) * $scope . pixelsPerSecond ;
1201
1218
@@ -1204,13 +1221,14 @@ $scope.SetTrackLabel = function (label) {
1204
1221
if ( ignore_ids . hasOwnProperty ( transition . id ) ) {
1205
1222
continue ;
1206
1223
}
1207
-
1224
+
1208
1225
diffs . push ( { 'diff' : position - tran_left_position , 'position' : tran_left_position } , // left side of transition
1209
1226
{ 'diff' : position - tran_right_position , 'position' : tran_right_position } ) ; // right side of transition
1210
1227
}
1211
1228
1212
1229
// Add marker positions to array
1213
- for ( const marker of $scope . project . markers ) {
1230
+ for ( var index = 0 ; index < $scope . project . markers . length ; index ++ ) {
1231
+ var marker = $scope . project . markers [ index ] ;
1214
1232
var marker_position = marker . position * $scope . pixelsPerSecond ;
1215
1233
1216
1234
diffs . push ( { 'diff' : position - marker_position , 'position' : marker_position } , // left side of marker
@@ -1221,19 +1239,19 @@ $scope.SetTrackLabel = function (label) {
1221
1239
var playhead_pixel_position = $scope . project . playhead_position * $scope . pixelsPerSecond ;
1222
1240
var playhead_diff = position - playhead_pixel_position ;
1223
1241
diffs . push ( { 'diff' : playhead_diff , 'position' : playhead_pixel_position } ) ;
1224
-
1242
+
1225
1243
// Loop through diffs (and find the smallest one)
1226
- for ( const each_diff of diffs ) {
1227
- var diff = each_diff . diff ;
1228
- var diff_position = each_diff . position ;
1244
+ for ( var diff_index = 0 ; diff_index < diffs . length ; diff_index ++ ) {
1245
+ var diff = diffs [ diff_index ] . diff ;
1246
+ var position = diffs [ diff_index ] . position ;
1229
1247
var abs_diff = Math . abs ( diff ) ;
1230
-
1248
+
1231
1249
// Check if this clip is nearby
1232
1250
if ( abs_diff < smallest_abs_diff && abs_diff <= threshold ) {
1233
1251
// This one is smaller
1234
1252
smallest_diff = diff ;
1235
1253
smallest_abs_diff = abs_diff ;
1236
- snapping_position = diff_position ;
1254
+ snapping_position = position ;
1237
1255
}
1238
1256
}
1239
1257
}
@@ -1328,7 +1346,9 @@ $scope.SetTrackLabel = function (label) {
1328
1346
$scope . ApplyJsonDiff = function ( jsonDiff ) {
1329
1347
1330
1348
// Loop through each UpdateAction
1331
- for ( const action of jsonDiff ) {
1349
+ for ( var action_index = 0 ; action_index < jsonDiff . length ; action_index ++ ) {
1350
+ var action = jsonDiff [ action_index ] ;
1351
+
1332
1352
// Iterate through the key levels (looking for a matching element in the $scope.project)
1333
1353
var previous_object = null ;
1334
1354
var current_object = $scope . project ;
0 commit comments