diff options
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 161 |
1 files changed, 94 insertions, 67 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 669dabef..c6b67c9c 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -27,7 +27,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
27 | }, | 27 | }, |
28 | set:function (value) { | 28 | set:function (value) { |
29 | this._trackID = value; | 29 | this._trackID = value; |
30 | this.needsDraw = true; | 30 | //this.needsDraw = true; |
31 | } | 31 | } |
32 | }, | 32 | }, |
33 | 33 | ||
@@ -114,7 +114,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
114 | }, | 114 | }, |
115 | set: function(newVal) { | 115 | set: function(newVal) { |
116 | this._arrStyleTracks = newVal; | 116 | this._arrStyleTracks = newVal; |
117 | this.needsDraw = true; | 117 | //this.needsDraw = true; |
118 | } | 118 | } |
119 | }, | 119 | }, |
120 | _styleTracksRepetition: { | 120 | _styleTracksRepetition: { |
@@ -128,7 +128,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
128 | }, | 128 | }, |
129 | set: function(newVal) { | 129 | set: function(newVal) { |
130 | this._styleTracksRepetition = newVal; | 130 | this._styleTracksRepetition = newVal; |
131 | this.needsDraw = true; | 131 | //needsDraw = true; |
132 | } | 132 | } |
133 | }, | 133 | }, |
134 | 134 | ||
@@ -146,7 +146,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
146 | }, | 146 | }, |
147 | set: function(newVal) { | 147 | set: function(newVal) { |
148 | this._arrPositionTracks = newVal; | 148 | this._arrPositionTracks = newVal; |
149 | this.needsDraw = true; | 149 | //this.needsDraw = true; |
150 | } | 150 | } |
151 | }, | 151 | }, |
152 | _positionTracksRepetition: { | 152 | _positionTracksRepetition: { |
@@ -160,7 +160,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
160 | }, | 160 | }, |
161 | set: function(newVal) { | 161 | set: function(newVal) { |
162 | this._positionTracksRepetition = newVal; | 162 | this._positionTracksRepetition = newVal; |
163 | this.needsDraw = true; | 163 | //this.needsDraw = true; |
164 | } | 164 | } |
165 | }, | 165 | }, |
166 | 166 | ||
@@ -179,7 +179,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
179 | }, | 179 | }, |
180 | set: function(newVal) { | 180 | set: function(newVal) { |
181 | this._arrTransformTracks = newVal; | 181 | this._arrTransformTracks = newVal; |
182 | this.needsDraw = true; | 182 | //this.needsDraw = true; |
183 | } | 183 | } |
184 | }, | 184 | }, |
185 | _transformTracksRepetition: { | 185 | _transformTracksRepetition: { |
@@ -193,7 +193,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
193 | }, | 193 | }, |
194 | set: function(newVal) { | 194 | set: function(newVal) { |
195 | this._transformTracksRepetition = newVal; | 195 | this._transformTracksRepetition = newVal; |
196 | this.needsDraw = true; | 196 | //this.needsDraw = true; |
197 | } | 197 | } |
198 | }, | 198 | }, |
199 | 199 | ||
@@ -209,7 +209,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
209 | }, | 209 | }, |
210 | set:function (newVal) { | 210 | set:function (newVal) { |
211 | this._tweens = newVal; | 211 | this._tweens = newVal; |
212 | this.needsDraw=true; | 212 | //this.needsDraw=true; |
213 | } | 213 | } |
214 | }, | 214 | }, |
215 | 215 | ||
@@ -345,6 +345,44 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
345 | _styleCollapser:{ | 345 | _styleCollapser:{ |
346 | value:null | 346 | value:null |
347 | }, | 347 | }, |
348 | |||
349 | _trackData:{ | ||
350 | |||
351 | }, | ||
352 | |||
353 | trackData:{ | ||
354 | serializable:true, | ||
355 | get:function(){ | ||
356 | return this._trackData; | ||
357 | }, | ||
358 | set:function(val){ | ||
359 | this._trackData = val; | ||
360 | if(this._trackData){ | ||
361 | this.setData(); | ||
362 | } | ||
363 | } | ||
364 | }, | ||
365 | |||
366 | setData:{ | ||
367 | value:function(){ | ||
368 | this.trackID = this.trackData.layerID; | ||
369 | this.tweens = this.trackData.tweens; | ||
370 | this.animatedElement = this.trackData.animatedElement; | ||
371 | this.arrStyleTracks = this.trackData.arrStyleTracks; | ||
372 | this.isTrackAnimated = this.trackData.isTrackAnimated; | ||
373 | this.trackDuration = this.trackData.trackDuration; | ||
374 | this.animationName = this.trackData.animationName; | ||
375 | this.currentKeyframeRule = this.trackData.currentKeyframeRule; | ||
376 | this.isMainCollapsed = this.trackData.isMainCollapsed; | ||
377 | this.isPositionCollapsed = this.trackData.isPositionCollapsed; | ||
378 | this.isTransformCollapsed = this.trackData.isTransformCollapsed; | ||
379 | this.bypassAnimation = this.trackData.bypassAnimation; | ||
380 | this.isStyleCollapsed = this.trackData.isStyleCollapsed; | ||
381 | this.trackPosition = this.trackData.trackPosition; | ||
382 | this.needsDraw = true; | ||
383 | } | ||
384 | }, | ||
385 | |||
348 | prepareForDraw:{ | 386 | prepareForDraw:{ |
349 | value:function () { | 387 | value:function () { |
350 | this.init(); | 388 | this.init(); |
@@ -356,20 +394,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
356 | draw:{ | 394 | draw:{ |
357 | value:function () { | 395 | value:function () { |
358 | this.ninjaStylesContoller = this.application.ninja.stylesController; | 396 | this.ninjaStylesContoller = this.application.ninja.stylesController; |
359 | return; | 397 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
360 | if (this._mainCollapser.isCollapsed !== this.isMainCollapsed) { | 398 | if(this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList[0]){ |
361 | this._mainCollapser.toggle(false); | 399 | this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList[0]; |
362 | } | ||
363 | if (this._positionCollapser.isCollapsed !== this.isPositionCollapsed) { | ||
364 | this._positionCollapser.toggle(false); | ||
365 | } | ||
366 | if (this._transformCollapser.isCollapsed !== this.isTransformCollapsed) { | ||
367 | this._transformCollapser.toggle(false); | ||
368 | } | ||
369 | if (this._styleCollapser.isCollapsed !== this.isStyleCollapsed) { | ||
370 | this._styleCollapser.toggle(false); | ||
371 | } | 400 | } |
372 | |||
373 | } | 401 | } |
374 | }, | 402 | }, |
375 | 403 | ||
@@ -378,7 +406,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
378 | if(!this.application.ninja.documentController.creatingNewFile){ | 406 | if(!this.application.ninja.documentController.creatingNewFile){ |
379 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ | 407 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ |
380 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 408 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
381 | if(!this.application.ninja.timeline.arrLayers[selectedIndex].created){ | 409 | if(!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created){ |
382 | this.retrieveStoredTweens(); | 410 | this.retrieveStoredTweens(); |
383 | } | 411 | } |
384 | } | 412 | } |
@@ -394,7 +422,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
394 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 422 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
395 | 423 | ||
396 | if (ev.shiftKey) { | 424 | if (ev.shiftKey) { |
397 | if (this.application.ninja.timeline.arrLayers[selectedIndex].elementsList.length == 1) { | 425 | if (this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList.length == 1) { |
398 | if (this.tweens.length < 1) { | 426 | if (this.tweens.length < 1) { |
399 | this.insertTween(0); | 427 | this.insertTween(0); |
400 | this.addAnimationRuleToElement(ev); | 428 | this.addAnimationRuleToElement(ev); |
@@ -410,7 +438,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
410 | 438 | ||
411 | handleNewTween:{ | 439 | handleNewTween:{ |
412 | value:function (ev) { | 440 | value:function (ev) { |
413 | if (ev.offsetX > this.tweens[this.tweens.length - 1].keyFramePosition) { | 441 | if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) { |
414 | this.insertTween(ev.offsetX); | 442 | this.insertTween(ev.offsetX); |
415 | } else { | 443 | } else { |
416 | this.splitTween(ev); | 444 | this.splitTween(ev); |
@@ -420,34 +448,32 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
420 | 448 | ||
421 | insertTween:{ | 449 | insertTween:{ |
422 | value:function (clickPos) { | 450 | value:function (clickPos) { |
423 | // calculate new tween's keyframe milliseconds by clickPos | ||
424 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | 451 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); |
425 | var currentMillisec = currentMillisecPerPixel * clickPos; | 452 | var currentMillisec = currentMillisecPerPixel * clickPos; |
426 | |||
427 | // need to check timeline master duration if greater than this track duration | ||
428 | this.trackDuration = currentMillisec; |