aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js')
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js432
1 files changed, 432 insertions, 0 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index 175b77f9..d602641e 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -15,7 +15,439 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
15 15
16 prepareForDraw:{ 16 prepareForDraw:{
17 value:function(){ 17 value:function(){
18 this.element.addEventListener("click", this, false);
19 this.trackID = this.parentComponent.parentComponent.parentComponent.trackID;
20 this.animatedElement = this.parentComponent.parentComponent.parentComponent.animatedElement;
21 this.ninjaStylesContoller = this.application.ninja.stylesController;
22 }
23 },
24
25 draw:{
26 value:function(){
27 console.log(this.currentKeyframeRule);
28 }
29 },
30
31 didDraw:{
32 value:function () {
33 if ((!this.application.ninja.documentController.creatingNewFile) || (!this.application.ninja.currentDocument.setLevel)) {
34 if (this.application.ninja.currentDocument.model.documentRoot.children[0]) {
35 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
36 if (selectedIndex !== false) {
37 if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) {
38 this.retrieveStoredStyleTweens();
39 }
40 }
41 }
42 }
43 }
44 },
45
46 trackEditorProperty:{
47 value:""
48 },
49
50 _propTweenRepetition:{
51 value:null
52 },
53
54 animatedElement:{
55 value:null
56 },
57
58 isSubproperty:{
59 value:true
60 },
61
62 propTweenRepetition:{
63 serializable:true,
64 get:function () {
65 return this._propTweenRepetition;
66 },
67 set:function (newVal) {
68 this._propTweenRepetition = newVal;
69 }
70 },
71
72 _propTweens:{
73 value:[]
74 },
75
76 propTweens:{
77 serializable:true,
78 get:function () {
79 return this._propTweens;
80 },
81 set:function (newVal) {
82 this._propTweens = newVal;
83 }
84 },
85
86 _propTrackData:{
87 value:false
88 },
89
90 propTrackData:{
91 serializable:true,
92 get:function () {
93 return this._propTrackData;
94 },
95 set:function (val) {
96 this._propTrackData = val;
97 if (this._propTrackData) {
98 this.setData();
99 }
100 }
101 },
102
103 nextKeyframe:{
104 value:1
105 },
106
107 ninjaStylesContoller:{
108 value:null
109 },
110
111 animationName:{
112 value:null
113 },
114
115 currentKeyframeRule:{
116 value:null
117 },
118
119 trackDuration:{
120 value:0
121 },
122
123 _trackID:{
124 value:null
125 },
126
127 trackID:{
128 serializable:true,
129 get:function () {
130 return this._trackID;
131 },
132 set:function (value) {
133 if (value !== this._trackID) {
134 this._trackID = value;
135 }
136 }
137 },
138
139 _trackType:{
140 value:null
141 },
142
143 trackType:{
144 serializable:true,
145 get:function () {
146 return this._trackType;
147 },
148 set:function (value) {
149 if (value !== this._trackType) {
150 this._trackType = value;
151 }
152 }
153 },
154
155 _styleIndex:{
156 value:null
157 },
158
159 styleIndex:{
160 serializable:true,
161 get:function () {
162 return this._styleIndex;
163 },
164 set:function (value) {
165 if (value !== this._styleIndex) {
166 this._styleIndex = value;
167 }
168 }
169 },
170
171 setData:{
172 value:function () {
173 if (typeof(this.propTrackData) === "undefined") {
174 return;
175 }
176
177 this.styleIndex = this.propTrackData.styleIndex;
178 this.propTweens = this.propTrackData.propTweens;
179 this.trackType = this.propTrackData.trackType;
180 this.trackEditorProperty = this.propTrackData.trackEditorProperty;
181 this.currentKeyframeRule = this.propTrackData.existingRule;
182 this.needsDraw = true;
183 }
184 },
185
186 handleClick:{
187 value:function (ev) {
188 if (ev.shiftKey) {
189
190 if (this.trackType == "position") {
191 this.parentComponent.parentComponent.parentComponent.handleNewTween(ev);
192 }
193
194 if (this.propTweens.length < 1) {
195
196 // check if there is an editor property assigned yet
197 // get this property track's editor prop name from layer data arrays
198 var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
199
200 if (this.trackType == "style") {
201 if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty == null) {
202 console.log("Please enter a style property for this track before adding keyframes.");
203 return;
204 } else {
205 this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty;
206 //console.log("Property track editorProperty set to: " + this.trackEditorProperty);
207 }
208 } else if (this.trackType == "position") {
209 //console.log("Property track editorProperty set to: " + this.trackEditorProperty);
210 }
211
212 this.insertPropTween(0);
213 this.addPropAnimationRuleToElement(ev);
214 this.updatePropKeyframeRule();
215 } else {
216 this.handleNewPropTween(ev);
217 this.updatePropKeyframeRule();
218 }
219 }
220 }
221 },
222
223 handleNewPropTween:{
224 value:function(ev){
225 if (ev.offsetX > this.propTweens[this.propTweens.length - 1].tweenData.keyFramePosition) {
226 this.insertPropTween(ev.offsetX);
227 } else {
228 console.log("Splitting style tweens not yet supported.");
229 }
230 }
231 },
232