aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js84
1 files changed, 49 insertions, 35 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index fddfd170..0c5121cd 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -1,3 +1,9 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
1var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage;
2var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
3var Collapser = require("js/panels/Timeline/Collapser").Collapser; 9var Collapser = require("js/panels/Timeline/Collapser").Collapser;
@@ -358,9 +364,11 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
358 364
359 didDraw:{ 365 didDraw:{
360 value:function () { 366 value:function () {
361 if (this._openDocRedrawCheck) { 367 if(this.application.ninja.currentDocument.documentRoot.children[0]){
362 this.retrieveStoredTweens(); 368 if (this._openDocRedrawCheck) {
363 this._openDocRedrawCheck = false; 369 this.retrieveStoredTweens();
370 this._openDocRedrawCheck = false;
371 }
364 } 372 }
365 } 373 }
366 }, 374 },
@@ -459,42 +467,48 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
459 this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0]; 467 this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0];
460 this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); 468 this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name");
461 this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); 469 this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration");
462 this.trackDuration = this.animationDuration.split("s"); 470 if(this.animationDuration){
463 this.currentMilliSec = this.trackDuration[0] * 1000; 471 this.trackDuration = this.animationDuration.split("s");
464 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 472 this.currentMilliSec = this.trackDuration[0] * 1000;
465 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 473 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
466 this.nextKeyframe = 0; 474 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
467 475 this.nextKeyframe = 0;
468 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); 476
469 while (this.currentKeyframeRule[i]) { 477 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
470 var newTween = {}; 478 while (this.currentKeyframeRule[i]) {
471 if (this.currentKeyframeRule[i].keyText === "0%") { 479 var newTween = {};
472 newTween.spanWidth = 0; 480
473 newTween.keyFramePosition = 0; 481 if (this.currentKeyframeRule[i].keyText === "0%") {
474 newTween.keyFrameMillisec = 0; 482 newTween.spanWidth = 0;
475 newTween.tweenID = 0; 483 newTween.keyFramePosition = 0;
476 newTween.spanPosition = 0; 484 newTween.keyFrameMillisec = 0;
477 this.tweens.push(newTween); 485 newTween.tweenID = 0;
486 newTween.spanPosition = 0;
487 this.tweens.push(newTween);
478 488
479 } 489 }
480 else { 490 else {
481 percentValue = this.currentKeyframeRule[i].keyText; 491 percentValue = this.currentKeyframeRule[i].keyText;
482 splitValue = percentValue.split("%"); 492 splitValue = percentValue.split("%");
483 fraction = splitValue[0] / 100; 493 fraction = splitValue[0] / 100;
484 this.currentMilliSec = fraction * this.trackDuration[0] * 1000; 494 this.currentMilliSec = fraction * this.trackDuration[0] * 1000;
485 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 495 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
486 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 496 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
487 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; 497 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition;
488 newTween.keyFramePosition = this.clickPos; 498 newTween.keyFramePosition = this.clickPos;
489 newTween.keyFrameMillisec = this.currentMilliSec; 499 newTween.keyFrameMillisec = this.currentMilliSec;
490 newTween.tweenID = this.nextKeyframe; 500 newTween.tweenID = this.nextKeyframe;
491 newTween.spanPosition = this.clickPos - newTween.spanWidth; 501 newTween.spanPosition = this.clickPos - newTween.spanWidth;
492 this.tweens.push(newTween); 502 this.tweens.push(newTween);
493 503
494 504
505 }
506 i++;
507 this.nextKeyframe += 1;
495 } 508 }
496 i++; 509 }
497 this.nextKeyframe += 1; 510 else{
511 return;
498 } 512 }
499 } 513 }
500 }, 514 },