diff options
author | Jonathan Duran | 2012-05-25 11:02:26 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-05-25 11:02:26 -0700 |
commit | 4a4bee3c7f1132d069926a5a8a67817a9df7a7e8 (patch) | |
tree | 096bdf95deb0a2868032ad0da7f2605d84d58f2a /js/panels/Timeline | |
parent | 003d08198368d93078049ee879aaac4275ac4817 (diff) | |
download | ninja-4a4bee3c7f1132d069926a5a8a67817a9df7a7e8.tar.gz |
update retrieveStoredTweens method
change the method to retrieve the keyframe styles for each keyframe generically instead of hard coding for top, left, width and height
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 9c8b5206..8d9fd964 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -764,17 +764,25 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
764 | var newTween = {}; | 764 | var newTween = {}; |
765 | newTween.tweenData = {}; | 765 | newTween.tweenData = {}; |
766 | 766 | ||
767 | offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); | 767 | var j, styleLength = this.currentKeyframeRule[i].style.length, keyframeStyles = []; |
768 | 768 | ||
769 | topOffSetAttribute = offsetAttribute[3].split("px"); | 769 | for(j=0; j<styleLength; j++){ |
770 | leftOffsetAttribute = offsetAttribute[5].split("px"); | 770 | // check for vendor prefixes and skip them for now |
771 | widthOffsetAttribute = offsetAttribute[7].split("px"); | 771 | var firstChar = this.currentKeyframeRule[i].style[j].charAt(0); |
772 | heightOffsetAttribute = offsetAttribute[9].split("px"); | 772 | if(firstChar === "-"){ |
773 | 773 | break; | |
774 | var tempTopOffset = parseInt(topOffSetAttribute[0]); | 774 | } else { |
775 | var tempLeftOffset = parseInt(leftOffsetAttribute[0]); | 775 | var currProp = this.currentKeyframeRule[i].style[j]; |
776 | var tempWidthOffset = parseInt(widthOffsetAttribute[0]); | 776 | var propVal = this.currentKeyframeRule[i].style[currProp]; |
777 | var tempHeightOffset = parseInt(heightOffsetAttribute[0]); | 777 | keyframeStyles.push([currProp, propVal]); |
778 | } | ||
779 | } | ||
780 | |||
781 | // recreate tween properties array for timeline tween | ||
782 | newTween.tweenData.tweenedProperties = []; | ||
783 | for(var k in keyframeStyles){ | ||
784 | newTween.tweenData.tweenedProperties[keyframeStyles[k][0]] = keyframeStyles[k][1]; | ||
785 | } | ||
778 | 786 | ||
779 | if (this.currentKeyframeRule[i].keyText === "0%") { | 787 | if (this.currentKeyframeRule[i].keyText === "0%") { |
780 | newTween.tweenData.spanWidth = 0; | 788 | newTween.tweenData.spanWidth = 0; |
@@ -782,11 +790,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
782 | newTween.tweenData.keyFrameMillisec = 0; | 790 | newTween.tweenData.keyFrameMillisec = 0; |
783 | newTween.tweenData.tweenID = 0; | 791 | newTween.tweenData.tweenID = 0; |
784 | newTween.tweenData.spanPosition = 0; | 792 | newTween.tweenData.spanPosition = 0; |
785 | newTween.tweenData.tweenedProperties = []; | ||
786 | newTween.tweenData.tweenedProperties["top"] = tempTopOffset + "px"; | ||
787 | newTween.tweenData.tweenedProperties["left"] = tempLeftOffset + "px"; | ||
788 | newTween.tweenData.tweenedProperties["width"] = tempWidthOffset + "px"; | ||
789 | newTween.tweenData.tweenedProperties["height"] = tempHeightOffset + "px"; | ||
790 | this.tweens.push(newTween); | 793 | this.tweens.push(newTween); |
791 | } | 794 | } |
792 | else { | 795 | else { |
@@ -804,11 +807,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
804 | newTween.tweenData.keyFrameMillisec = currentMilliSec; | 807 | newTween.tweenData.keyFrameMillisec = currentMilliSec; |
805 | newTween.tweenData.tweenID = this.nextKeyframe; | 808 | newTween.tweenData.tweenID = this.nextKeyframe; |
806 | newTween.tweenData.spanPosition =clickPosition - newTween.tweenData.spanWidth; | 809 | newTween.tweenData.spanPosition =clickPosition - newTween.tweenData.spanWidth; |
807 | newTween.tweenData.tweenedProperties=[]; | ||
808 | newTween.tweenData.tweenedProperties["top"] = tempTopOffset + "px"; | ||
809 | newTween.tweenData.tweenedProperties["left"] = tempLeftOffset + "px"; | ||
810 | newTween.tweenData.tweenedProperties["width"] = tempWidthOffset + "px"; | ||
811 | newTween.tweenData.tweenedProperties["height"] = tempHeightOffset + "px"; | ||
812 | this.tweens.push(newTween); | 810 | this.tweens.push(newTween); |
813 | } | 811 | } |
814 | this.nextKeyframe += 1; | 812 | this.nextKeyframe += 1; |