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.js361
1 files changed, 361 insertions, 0 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index 175b77f9..1e495402 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -15,7 +15,368 @@ 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
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.needsDraw = true;
182 }
183 },
184
185 handleClick:{
186 value:function (ev) {
187 if (ev.shiftKey) {
188
189 if (this.trackType == "position") {
190 this.parentComponent.parentComponent.parentComponent.handleNewTween(ev);
191 }
192
193 if (this.propTweens.length < 1) {
194
195 // check if there is an editor property assigned yet
196 // get this property track's editor prop name from layer data arrays
197 var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
198
199 if (this.trackType == "style") {
200 if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty == null) {
201 console.log("Please enter a style property for this track before adding keyframes.");
202 return;
203 } else {
204 this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty;
205 //console.log("Property track editorProperty set to: " + this.trackEditorProperty);
206 }
207 } else if (this.trackType == "position") {
208 //console.log("Property track editorProperty set to: " + this.trackEditorProperty);
209 }
210
211 this.insertPropTween(0);
212 this.addPropAnimationRuleToElement(ev);
213 this.updatePropKeyframeRule();
214 } else {
215 this.handleNewPropTween(ev);
216 this.updatePropKeyframeRule();
217 }
218 }
219 }
220 },
221
222 handleNewPropTween:{
223 value:function(ev){
224 if (ev.offsetX > this.propTweens[this.propTweens.length - 1].tweenData.keyFramePosition) {
225 this.insertPropTween(ev.offsetX);
226 } else {
227 console.log("Splitting style tweens not yet supported.");
228 }
229 }
230 },
231
232 insertPropTween:{
233 value:function(clickPos){
234