aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
authorJonathan Duran2012-05-24 10:49:09 -0700
committerJonathan Duran2012-05-24 10:49:09 -0700
commit003d08198368d93078049ee879aaac4275ac4817 (patch)
treee7c2076b9af60f523643e0d2ae1e91f8c673cebb /js/panels/Timeline
parent9809c96d96c24a512f6da1efbf44f174ca9321fe (diff)
downloadninja-003d08198368d93078049ee879aaac4275ac4817.tar.gz
collapse fix for restored style layers
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js51
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js16
2 files changed, 34 insertions, 33 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index a5722335..9c8b5206 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -664,10 +664,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
664 newTween.tweenData.tweenID = 0; 664 newTween.tweenData.tweenID = 0;
665 newTween.tweenData.spanPosition = 0; 665 newTween.tweenData.spanPosition = 0;
666 newTween.tweenData.tweenedProperties = []; 666 newTween.tweenData.tweenedProperties = [];
667 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; 667 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px";
668 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; 668 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px";
669 newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; 669 newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px";
670 newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; 670 newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px";
671 this.tweens.push(newTween); 671 this.tweens.push(newTween);
672 } else { 672 } else {
673 newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition; 673 newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition;
@@ -676,10 +676,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
676 newTween.tweenData.tweenID = this.nextKeyframe; 676 newTween.tweenData.tweenID = this.nextKeyframe;
677 newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth; 677 newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth;
678 newTween.tweenData.tweenedProperties = []; 678 newTween.tweenData.tweenedProperties = [];
679 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; 679 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px";
680 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; 680 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px";
681 newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; 681 newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px";
682 newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; 682 newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px";
683 this.tweens.push(newTween); 683 this.tweens.push(newTween);
684 684
685 // update the animation duration 685 // update the animation duration
@@ -721,10 +721,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
721 newTweenToInsert.tweenData.tweenID = splitTweenIndex - 1; 721 newTweenToInsert.tweenData.tweenID = splitTweenIndex - 1;
722 newTweenToInsert.tweenData.spanPosition = clickPos - newTweenToInsert.tweenData.spanWidth; 722 newTweenToInsert.tweenData.spanPosition = clickPos - newTweenToInsert.tweenData.spanWidth;
723 newTweenToInsert.tweenData.tweenedProperties = []; 723 newTweenToInsert.tweenData.tweenedProperties = [];
724 newTweenToInsert.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; 724 newTweenToInsert.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px";
725 newTweenToInsert.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; 725 newTweenToInsert.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px";
726 newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; 726 newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px";
727 newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; 727 newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px";
728 this.tweens.splice(splitTweenIndex, 0, newTweenToInsert); 728 this.tweens.splice(splitTweenIndex, 0, newTweenToInsert);
729 break; 729 break;
730 } 730 }
@@ -783,10 +783,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
783 newTween.tweenData.tweenID = 0; 783 newTween.tweenData.tweenID = 0;
784 newTween.tweenData.spanPosition = 0; 784 newTween.tweenData.spanPosition = 0;
785 newTween.tweenData.tweenedProperties = []; 785 newTween.tweenData.tweenedProperties = [];
786 newTween.tweenData.tweenedProperties["top"] = tempTopOffset; 786 newTween.tweenData.tweenedProperties["top"] = tempTopOffset + "px";
787 newTween.tweenData.tweenedProperties["left"] = tempLeftOffset; 787 newTween.tweenData.tweenedProperties["left"] = tempLeftOffset + "px";
788 newTween.tweenData.tweenedProperties["width"] = tempWidthOffset; 788 newTween.tweenData.tweenedProperties["width"] = tempWidthOffset + "px";
789 newTween.tweenData.tweenedProperties["height"] = tempHeightOffset; 789 newTween.tweenData.tweenedProperties["height"] = tempHeightOffset + "px";
790 this.tweens.push(newTween); 790 this.tweens.push(newTween);
791 } 791 }
792 else { 792 else {
@@ -805,10 +805,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
805 newTween.tweenData.tweenID = this.nextKeyframe; 805 newTween.tweenData.tweenID = this.nextKeyframe;
806 newTween.tweenData.spanPosition =clickPosition - newTween.tweenData.spanWidth; 806 newTween.tweenData.spanPosition =clickPosition - newTween.tweenData.spanWidth;
807 newTween.tweenData.tweenedProperties=[]; 807 newTween.tweenData.tweenedProperties=[];
808 newTween.tweenData.tweenedProperties["top"] = tempTopOffset; 808 newTween.tweenData.tweenedProperties["top"] = tempTopOffset + "px";
809 newTween.tweenData.tweenedProperties["left"] = tempLeftOffset; 809 newTween.tweenData.tweenedProperties["left"] = tempLeftOffset + "px";
810 newTween.tweenData.tweenedProperties["width"] = tempWidthOffset; 810 newTween.tweenData.tweenedProperties["width"] = tempWidthOffset + "px";
811 newTween.tweenData.tweenedProperties["height"] = tempHeightOffset; 811 newTween.tweenData.tweenedProperties["height"] = tempHeightOffset + "px";
812 this.tweens.push(newTween); 812 this.tweens.push(newTween);
813 } 813 }
814 this.nextKeyframe += 1; 814 this.nextKeyframe += 1;
@@ -851,16 +851,14 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
851 851
852 addAnimationRuleToElement:{ 852 addAnimationRuleToElement:{
853 value:function (tweenEvent) { 853 value:function (tweenEvent) {
854 this.tweens[0].tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; 854 this.tweens[0].tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px";
855 this.tweens[0].tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; 855 this.tweens[0].tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px";
856 var animationDuration = Math.round(this.trackDuration / 1000) + "s"; 856 var animationDuration = Math.round(this.trackDuration / 1000) + "s";
857 this.animationName = this.animatedElement.classList[0] + "_PositionSize"; 857 this.animationName = this.animatedElement.classList[0] + "_PositionSize";
858 this.animationNamesString = this.animationName; 858 this.animationNamesString = this.animationName;
859 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", this.animationName); 859 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", this.animationName);
860 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", animationDuration); 860 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", animationDuration);
861 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", 1); 861 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", 1);
862 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-fill-mode", "both");
863 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-transition-timing-function", "linear");
864 var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {top: " + this.animatedElement.offsetTop + "px; left: " + this.animatedElement.offsetLeft + "px;} 100% {top: " + this.animatedElement.offsetTop + "px; left: " + this.animatedElement.offsetLeft + "px;} }"; 862 var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {top: " + this.animatedElement.offsetTop + "px; left: " + this.animatedElement.offsetLeft + "px;} 100% {top: " + this.animatedElement.offsetTop + "px; left: " + this.animatedElement.offsetLeft + "px;} }";
865 863
866 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule); 864 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule);
@@ -885,12 +883,14 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
885 var keyframePercent = Math.round((keyMill / trackDur) * 100) + "%"; 883 var keyframePercent = Math.round((keyMill / trackDur) * 100) + "%";
886 var keyframePropertyString = " " + keyframePercent + " {"; 884 var keyframePropertyString = " " + keyframePercent + " {";
887 for(var prop in this.tweens[i].tweenData.tweenedProperties){ 885 for(var prop in this.tweens[i].tweenData.tweenedProperties){
888 keyframePropertyString += prop + ": " + this.tweens[i].tweenData.tweenedProperties[prop] + "px;"; 886 console.log(prop + " - " + this.tweens[i].tweenData.tweenedProperties[prop]);
887 keyframePropertyString += prop + ": " + this.tweens[i].tweenData.tweenedProperties[prop] + ";";
889 } 888 }
890 keyframePropertyString += "}"; 889 keyframePropertyString += "}";
891 keyframeString += keyframePropertyString; 890 keyframeString += keyframePropertyString;
892 } 891 }
893 keyframeString += " }"; 892 keyframeString += " }";
893 console.log(keyframeString);
894 // set the keyframe string as the new rule 894 // set the keyframe string as the new rule
895 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(keyframeString); 895 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(keyframeString);
896 this.application.ninja.documentController.activeDocument.needsSave = true; 896 this.application.ninja.documentController.activeDocument.needsSave = true;
@@ -978,6 +978,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
978 this.arrStyleTracks.push(restoredStyleTrack); 978 this.arrStyleTracks.push(restoredStyleTrack);
979 979
980 this.isStyleCollapsed = true; 980 this.isStyleCollapsed = true;
981 this.triggerOutgoingBinding();
981 } 982 }
982 else if (layerEvent.layerEventType === "deleteStyle") { 983 else if (layerEvent.layerEventType === "deleteStyle") {
983 // TODO: Delete the right track. Index can be passed in event object, use that for splice(). 984 // TODO: Delete the right track. Index can be passed in event object, use that for splice().
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index 414c0535..e5288ad9 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -195,16 +195,16 @@ var Tween = exports.Tween = Montage.create(Component, {
195 setTweenProperties:{ 195 setTweenProperties:{
196 value:function (eventDetail) { 196 value:function (eventDetail) {
197 if(this.parentComponent.parentComponent.animatedElement.offsetTop != this.tweenedProperties["top"]){ 197 if(this.parentComponent.parentComponent.animatedElement.offsetTop != this.tweenedProperties["top"]){
198 this.tweenedProperties["top"] = this.parentComponent.parentComponent.animatedElement.offsetTop; 198 this.tweenedProperties["top"] = this.parentComponent.parentComponent.animatedElement.offsetTop + "px";
199 } 199 }
200 if(this.parentComponent.parentComponent.animatedElement.offsetLeft != this.tweenedProperties["left"]){ 200 if(this.parentComponent.parentComponent.animatedElement.offsetLeft != this.tweenedProperties["left"]){
201 this.tweenedProperties["left"] = this.parentComponent.parentComponent.animatedElement.offsetLeft; 201 this.tweenedProperties["left"] = this.parentComponent.parentComponent.animatedElement.offsetLeft + "px";
202 } 202 }
203 if (this.parentComponent.parentComponent.animatedElement.offsetWidth != this.tweenedProperties["width"]){ 203 if (this.parentComponent.parentComponent.animatedElement.offsetWidth != this.tweenedProperties["width"]){
204 this.tweenedProperties["width"] = this.parentComponent.parentComponent.animatedElement.offsetWidth; 204 this.tweenedProperties["width"] = this.parentComponent.parentComponent.animatedElement.offsetWidth + "px";
205 } 205 }
206 if (this.parentComponent.parentComponent.animatedElement.offsetHeight != this.tweenedProperties["height"]){ 206 if (this.parentComponent.parentComponent.animatedElement.offsetHeight != this.tweenedProperties["height"]){
207 this.tweenedProperties["height"] = this.parentComponent.parentComponent.animatedElement.offsetHeight; 207 this.tweenedProperties["height"] = this.parentComponent.parentComponent.animatedElement.offsetHeight + "px";
208 } 208 }
209 // tell track to update css rule 209 // tell track to update css rule
210 this.parentComponent.parentComponent.updateKeyframeRule(); 210 this.parentComponent.parentComponent.updateKeyframeRule();
@@ -278,10 +278,10 @@ var Tween = exports.Tween = Montage.create(Component, {
278 console.log(currentValue); 278 console.log(currentValue);
279 } else { 279 } else {
280 // move animated element to correct position on stage 280 // move animated element to correct position on stage
281 var currentTop = this.tweenedProperties["top"] + "px"; 281 var currentTop = this.tweenedProperties["top"];
282 var currentLeft = this.tweenedProperties["left"] + "px"; 282 var currentLeft = this.tweenedProperties["left"];
283 var currentWidth = this.tweenedProperties["width"] + "px"; 283 var currentWidth = this.tweenedProperties["width"];
284 var currentHeight = this.tweenedProperties["height"] + "px"; 284 var currentHeight = this.tweenedProperties["height"];