aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJonathan Duran2012-05-04 21:46:29 -0700
committerJonathan Duran2012-05-04 21:46:29 -0700
commiteaef072648eb539e648aabf7bc1aea8d02c21085 (patch)
tree0474ea8c48d8624a0c82bd08f9ed7de63b48b50c /js
parent0e12f00d6afffabd370347335a56d0ddd17c0232 (diff)
downloadninja-eaef072648eb539e648aabf7bc1aea8d02c21085.tar.gz
property track additions to serialization data object
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js3
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js75
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html2
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js12
4 files changed, 72 insertions, 20 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index b23da749..ef51886e 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -606,6 +606,7 @@ var Layer = exports.Layer = Montage.create(Component, {
606 newEvent.layerEventLocale = "styles"; 606 newEvent.layerEventLocale = "styles";
607 newEvent.layerEventType = "newStyle"; 607 newEvent.layerEventType = "newStyle";
608 newEvent.layerID = this.layerID; 608 newEvent.layerID = this.layerID;
609 newEvent.styleIndex = this._styleCounter;
609 newEvent.styleID = this.layerID + "@" + this._styleCounter; 610 newEvent.styleID = this.layerID + "@" + this._styleCounter;
610 611
611 newStyle.styleID = newEvent.styleID; 612 newStyle.styleID = newEvent.styleID;
@@ -629,7 +630,7 @@ var Layer = exports.Layer = Montage.create(Component, {
629 } 630 }
630 631
631 // Set up the event info and dispatch the event 632 // Set up the event info and dispatch the event
632 633 this._styleCounter += 1;
633 newEvent.styleSelection = mySelection; 634 newEvent.styleSelection = mySelection;
634 defaultEventManager.dispatchEvent(newEvent); 635 defaultEventManager.dispatchEvent(newEvent);
635 636
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index 60da4e71..f2dbd683 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -27,6 +27,10 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
27 } 27 }
28 }, 28 },
29 29
30 trackEditorProperty:{
31 value:""
32 },
33
30 _propTweenRepetition:{ 34 _propTweenRepetition:{
31 value:null 35 value:null
32 }, 36 },
@@ -68,6 +72,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
68 }, 72 },
69 73
70 propTrackData:{ 74 propTrackData:{
75 serializable:true,
71 get:function () { 76 get:function () {
72 return this._propTrackData; 77 return this._propTrackData;
73 }, 78 },
@@ -79,19 +84,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
79 } 84 }
80 }, 85 },
81 86
82 setData:{
83 value:function(){
84 if (typeof(this.propTrackData) === "undefined") {
85 return;
86 }
87
88
89 this.propTweens = this.propTrackData.propTweens;
90
91 this.needsDraw = true;
92 }
93 },
94
95 nextKeyframe:{ 87 nextKeyframe:{
96 value:1 88 value:1
97 }, 89 },
@@ -108,16 +100,66 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
108 set:function (value) { 100 set:function (value) {
109 if (value !== this._trackID) { 101 if (value !== this._trackID) {
110 this._trackID = value; 102 this._trackID = value;
111 this.propTrackData.layerID = value;
112 } 103 }
113 } 104 }
114 }, 105 },
115 106
107 _styleSelection:{
108 value:null
109 },
110
111 styleSelection:{
112 serializable:true,
113 get:function () {
114 return this._styleSelection;
115 },
116 set:function (value) {
117 if (value !== this._styleSelection) {
118 this._styleSelection = value;
119 }
120 }
121 },
122
123 _styleIndex:{
124 value:null
125 },
126
127 styleIndex:{
128 serializable:true,
129 get:function () {
130 return this._styleIndex;
131 },
132 set:function (value) {
133 if (value !== this._styleIndex) {
134 this._styleIndex = value;
135 }
136 }
137 },
138
139 setData:{
140 value:function () {
141 if (typeof(this.propTrackData) === "undefined") {
142 return;
143 }
144
145 this.styleIndex = this.propTrackData.styleIndex;
146 this.propTweens = this.propTrackData.propTweens;
147 this.styleSelection = this.propTrackData.styleSelection;
148 this.needsDraw = true;
149 }
150 },
151
116 handleClick:{ 152 handleClick:{
117 value:function(ev){ 153 value:function(ev){
118 //console.log(this.application.ninja.timeline.arrLayers[selectedIndex].layerData);
119 if (ev.shiftKey) { 154 if (ev.shiftKey) {
120 if (this.propTweens.length < 1) { 155 if (this.propTweens.length < 1) {
156
157 // check if there is an editor property assigned yet
158 // get this property track's editor prop name from layer data arrays
159 var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
160 console.log(this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles);
161 console.log(this.styleIndex);
162
121 this.insertPropTween(0); 163 this.insertPropTween(0);
122 this.addPropAnimationRuleToElement(ev); 164 this.addPropAnimationRuleToElement(ev);
123 this.updatePropKeyframeRule(); 165 this.updatePropKeyframeRule();
@@ -137,8 +179,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
137 179
138 insertPropTween:{ 180 insertPropTween:{
139 value:function(clickPos){ 181 value:function(clickPos){
140 var parentTrackID = this.parentComponent.parentComponent.parentComponent.trackID; 182 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
141 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(parentTrackID);
142 this.application.ninja.timeline.selectLayer(selectedIndex, true); 183 this.application.ninja.timeline.selectLayer(selectedIndex, true);
143 184
144 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 185 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
index de2969bb..ed013505 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
@@ -72,7 +72,7 @@
72 "element":{"#": "style-track-base"} 72 "element":{"#": "style-track-base"}
73 }, 73 },
74 "bindings" : { 74 "bindings" : {
75 "trackData" : { 75 "propTrackData" : {
76 "boundObject" : {"@" : "styleTrackRepetition"}, 76 "boundObject" : {"@" : "styleTrackRepetition"},
77 "boundObjectPropertyPath" : "objectAtCurrentIteration.propTrackData", 77 "boundObjectPropertyPath" : "objectAtCurrentIteration.propTrackData",
78 "oneway" : false 78 "oneway" : false
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 000c81e2..8bb00990 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -710,7 +710,17 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
710 } 710 }
711 if (layerEvent.layerEventType === "newStyle") { 711 if (layerEvent.layerEventType === "newStyle") {
712 // TODO: Add a real track of tweens. Probably need a method for that. 712 // TODO: Add a real track of tweens. Probably need a method for that.
713 this.arrStyleTracks.push("1"); 713
714 var newStyleTrack = {};
715 newStyleTrack.propTrackData = {};
716 newStyleTrack.propTrackData.styleSelection = layerEvent.styleSelection;
717 newStyleTrack.propTrackData.propTweens = [];
718 newStyleTrack.propTrackData.styleIndex = layerEvent.styleIndex;
719 console.log(layerEvent.styleSelection);
720 console.log(layerEvent.styleIndex);
721
722 this.arrStyleTracks.push(newStyleTrack);
723
714 } else if (layerEvent.layerEventType === "deleteStyle") { 724 } else if (layerEvent.layerEventType === "deleteStyle") {
715 // TODO: Delete the right track. Index can be passed in event object, use that for splice(). 725 // TODO: Delete the right track. Index can be passed in event object, use that for splice().
716 this.arrStyleTracks.pop(); 726 this.arrStyleTracks.pop();