diff options
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 433 |
1 files changed, 433 insertions, 0 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js new file mode 100644 index 00000000..62688825 --- /dev/null +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -0,0 +1,433 @@ | |||
1 | var Montage = require("montage/core/core").Montage; | ||
2 | var Component = require("montage/ui/component").Component; | ||
3 | var Collapser = require("js/panels/Timeline/Collapser").Collapser; | ||
4 | var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; | ||
5 | |||
6 | var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | ||
7 | |||
8 | hasTemplate:{ | ||
9 | value:true | ||
10 | }, | ||
11 | |||
12 | _trackID:{ | ||
13 | value:null, | ||
14 | writable:true, | ||
15 | serializable:true, | ||
16 | enumerable:true | ||
17 | }, | ||
18 | |||
19 | trackID:{ | ||
20 | serializable:true, | ||
21 | get:function () { | ||
22 | return this._trackID; | ||
23 | }, | ||
24 | set:function (value) { | ||
25 | this._trackID = value; | ||
26 | this.needsDraw = true; | ||
27 | } | ||
28 | }, | ||
29 | |||
30 | // Are the various collapsers collapsed or not | ||
31 | _isMainCollapsed:{ | ||
32 | value:"" | ||
33 | }, | ||
34 | isMainCollapsed:{ | ||
35 | get:function () { | ||
36 | return this._isMainCollapsed; | ||
37 | }, | ||
38 | set:function (newVal) { | ||
39 | if (newVal !== this._isMainCollapsed) { | ||
40 | this._isMainCollapsed = newVal; | ||
41 | this.needsDraw = true; | ||
42 | } | ||
43 | |||
44 | } | ||
45 | }, | ||
46 | _isTransformCollapsed:{ | ||
47 | value:true | ||
48 | }, | ||
49 | isTransformCollapsed:{ | ||
50 | get:function () { | ||
51 | return this._isTransformCollapsed; | ||
52 | }, | ||
53 | set:function (newVal) { | ||
54 | if (newVal !== this._isTransformCollapsed) { | ||
55 | this._isTransformCollapsed = newVal; | ||
56 | this.needsDraw = true; | ||
57 | } | ||
58 | } | ||
59 | }, | ||
60 | _isPositionCollapsed:{ | ||
61 | value:true | ||
62 | }, | ||
63 | isPositionCollapsed:{ | ||
64 | get:function () { | ||
65 | return this._isPositionCollapsed; | ||
66 | }, | ||
67 | set:function (newVal) { | ||
68 | if (newVal !== this._isPositionCollapsed) { | ||
69 | this._isPositionCollapsed = newVal; | ||
70 | this.needsDraw = true; | ||
71 | } | ||
72 | } | ||
73 | }, | ||
74 | _isStyleCollapsed:{ | ||
75 | value:true | ||
76 | }, | ||
77 | isStyleCollapsed:{ | ||
78 | get:function () { | ||
79 | return this._isStyleCollapsed; | ||
80 | }, | ||
81 | set:function (newVal) { | ||
82 | if (newVal !== this._isStyleCollapsed) { | ||
83 | this._isStyleCollapsed = newVal; | ||
84 | this.needsDraw = true; | ||
85 | } | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | _tweens:{ | ||
90 | serializable:true, | ||
91 | enumerable:true, | ||
92 | value:[] | ||
93 | }, | ||
94 | |||
95 | tweens:{ | ||
96 | serializable:true, | ||
97 | enumerable:true, | ||
98 | get:function () { | ||
99 | return this._spans; | ||
100 | }, | ||
101 | set:function (newVal) { | ||
102 | this._spans = newVal; | ||
103 | } | ||
104 | }, | ||
105 | |||
106 | _tweenRepetition:{ | ||
107 | serializable:true, | ||
108 | value:null | ||
109 | }, | ||
110 | |||
111 | tweenRepetition:{ | ||
112 | serializable:true, | ||
113 | get:function () { | ||
114 | return this._spanRepetition; | ||
115 | }, | ||
116 | set:function (newVal) { | ||
117 | this._spanRepetition = newVal; | ||
118 | } | ||
119 | }, | ||
120 | |||
121 | trackDuration:{ | ||
122 | value:0 | ||
123 | }, | ||
124 | |||
125 | currentKeyframeRule:{ | ||
126 | value:null | ||
127 | }, | ||
128 | |||
129 | nextKeyframe:{ | ||
130 | value:1 | ||
131 | }, | ||
132 | |||
133 | currentMillisecClicked:{ | ||
134 | value:0 | ||
135 | }, | ||
136 | |||
137 | isAnimated:{ | ||
138 | value:false | ||
139 | }, | ||
140 | |||
141 | _animatedElement:{ | ||
142 | serializable:true, | ||
143 | enumerable:true, | ||
144 | writable:true, | ||
145 | value:null | ||
146 | }, | ||
147 | |||
148 | animatedElement:{ | ||
149 | serializable:true, | ||
150 | get:function () { | ||
151 | return this._animatedElement; | ||
152 | }, | ||
153 | set:function (val) { | ||
154 | this._animatedElement = val; | ||
155 | } | ||
156 | }, | ||
157 | |||
158 | animationName:{ | ||
159 | value:null | ||
160 | }, | ||
161 | |||
162 | keyFramePropertyData:{ | ||
163 | value:[] | ||
164 | }, | ||
165 | |||
166 | ninjaStylesContoller:{ | ||
167 | value:null | ||
168 | }, | ||
169 | |||
170 | _positionCollapser:{ | ||
171 | value:null | ||
172 | }, | ||
173 | _mainCollapser:{ | ||
174 | value:null | ||
175 | }, | ||
176 | _transformCollapser:{ | ||
177 | value:null | ||
178 | }, | ||
179 | _styleCollapser:{ | ||
180 | value:null | ||
181 | }, | ||
182 | |||
183 | prepareForDraw:{ | ||
184 | value:function () { | ||
185 | this.init(); | ||
186 | this.ninjaStylesContoller = this.application.ninja.stylesController; | ||
187 | this.track_lane.addEventListener("click", this, false); | ||
188 | this.keyFramePropertyData = new Array(); | ||
189 | } | ||
190 | }, | ||
191 | |||
192 | draw:{ | ||
193 | value:function () { | ||
194 | if (this._mainCollapser.isCollapsed !== this.isMainCollapsed) { | ||
195 | this._mainCollapser.toggle(false); | ||
196 | } | ||
197 | if (this._positionCollapser.isCollapsed !== this.isPositionCollapsed) { | ||
198 | this._positionCollapser.toggle(false); | ||
199 | } | ||
200 | if (this._transformCollapser.isCollapsed !== this.isTransformCollapsed) { | ||
201 | this._transformCollapser.toggle(false); | ||
202 | } | ||
203 | if (this._styleCollapser.isCollapsed !== this.isStyleCollapsed) { | ||
204 | this._styleCollapser.toggle(false); | ||
205 | } | ||
206 | } | ||
207 | }, | ||
208 | |||
209 | handleClick:{ | ||
210 | value:function (ev) { | ||
211 | // TEMP - if the SHIFT key is down, add a new keyframe or split an existing span | ||
212 | // This needs to move to a keyboard shortcut that is TBD | ||
213 | if (ev.shiftKey) { | ||
214 | if (this.application.ninja.timeline.arrLayers[this.trackID - 1].element.length == 1) { | ||
215 | if (this.tweens.length < 1) { | ||
216 | this.insertTween(0); | ||
217 | this.addAnimationRuleToElement(ev); | ||
218 | } else { | ||
219 | this.handleNewTween(ev); | ||
220 | } | ||
221 | } else { | ||
222 | alert("There must be exactly one element in an animated layer.") | ||
223 | } | ||
224 | } |