-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.jsx
38 lines (34 loc) · 1.07 KB
/
common.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function collectionToArray(collection) {
var arr = [];
for (var i = 0; i < collection.length; i++) {
arr.push(collection[i]);
}
return arr;
}
function getComponentByDisplayName(components, name) {
for (var i = 0; i < components.length; i++) {
var component = components[i];
if (name === component.displayName) {
return component;
}
}
return null;
}
function getComponentParamByDisplayName(componentProperties, name) {
for (var i = 0; i < componentProperties.length; i++) {
var property = componentProperties[i];
if (name === property.displayName) {
return property;
}
}
return null;
}
function getTrackOfClip(tracks, clip) {
for (var trackIndex = 0; trackIndex < tracks.numTracks; trackIndex++) {
var track = tracks[trackIndex];
for (var clipIndex = 0; clipIndex < track.clips.length; clipIndex++) {
if (track.clips[clipIndex].nodeId === clip.nodeId) return track;
}
}
return null;
}