diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 478 |
1 files changed, 238 insertions, 240 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 91277a63..087bf3cd 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -49,6 +49,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
49 | value: function() { | 49 | value: function() { |
50 | if (this._boolCacheArrays) { | 50 | if (this._boolCacheArrays) { |
51 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 51 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
52 | |||
52 | } | 53 | } |
53 | } | 54 | } |
54 | }, | 55 | }, |
@@ -69,6 +70,39 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
69 | set:function (newVal) { | 70 | set:function (newVal) { |
70 | if (newVal !== this._currentLayerNumber) { | 71 | if (newVal !== this._currentLayerNumber) { |
71 | this._currentLayerNumber = newVal; | 72 | this._currentLayerNumber = newVal; |
73 | this._setCurrentLayerNumber(); | ||
74 | } | ||
75 | } | ||
76 | }, | ||
77 | |||
78 | _setCurrentLayerNumber:{ | ||
79 | value:function(){ | ||
80 | if (this._boolCacheArrays) { | ||
81 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | ||
82 | } | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | _hashKey:{ | ||
87 | value:0 | ||
88 | }, | ||
89 | |||
90 | hashKey:{ | ||
91 | get:function () { | ||
92 | return this._hashKey; | ||
93 | }, | ||
94 | set:function (newVal) { | ||
95 | if (newVal !== this._hashKey) { | ||
96 | this._hashKey = newVal; | ||
97 | this._setHashKey(); | ||
98 | } | ||
99 | } | ||
100 | }, | ||
101 | |||
102 | _setHashKey:{ | ||
103 | value:function(){ | ||
104 | if (this._boolCacheArrays) { | ||
105 | this.application.ninja.currentDocument.hashKey = this.hashKey; | ||
72 | } | 106 | } |
73 | } | 107 | } |
74 | }, | 108 | }, |
@@ -97,22 +131,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
97 | } | 131 | } |
98 | }, | 132 | }, |
99 | 133 | ||
100 | _arrTracks:{ | ||
101 | serializable:true, | ||
102 | value:[] | ||
103 | }, | ||
104 | |||
105 | arrTracks:{ | ||
106 | serializable:true, | ||
107 | get:function () { | ||
108 | return this._arrTracks; | ||
109 | }, | ||
110 | set:function (newVal) { | ||
111 | this._arrTracks = newVal; | ||
112 | this._cacheArrays(); | ||
113 | } | ||
114 | }, | ||
115 | |||
116 | _trackRepetition:{ | 134 | _trackRepetition:{ |
117 | serializable:true, | 135 | serializable:true, |
118 | value:null | 136 | value:null |
@@ -156,6 +174,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
156 | } | 174 | } |
157 | }, | 175 | }, |
158 | 176 | ||
177 | _breadCrumbContainer:{ | ||
178 | value:null | ||
179 | }, | ||
180 | |||
181 | breadCrumbContainer: { | ||
182 | set: function(value) { | ||
183 | if(this._breadCrumbContainer !== value) { | ||
184 | this._breadCrumbContainer = value; | ||
185 | this.LayerBinding(this.application.ninja.currentSelectedContainer); | ||
186 | } | ||
187 | }, | ||
188 | get: function() { | ||
189 | return this._breadCrumbContainer; | ||
190 | } | ||
191 | }, | ||
192 | |||
159 | _isLayer:{ | 193 | _isLayer:{ |
160 | value:false | 194 | value:false |
161 | }, | 195 | }, |
@@ -204,11 +238,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
204 | value: function(boolUnbind) { | 238 | value: function(boolUnbind) { |
205 | var arrEvents = ["deleteLayerClick", | 239 | var arrEvents = ["deleteLayerClick", |
206 | "newLayer", | 240 | "newLayer", |
207 | "deleteLayer", | 241 | "deleteLayer", |
208 | "layerBinding", | ||
209 | "elementAdded", | 242 | "elementAdded", |
210 | "elementDeleted", | 243 | "elementDeleted", |
211 | "deleteSelection", | ||
212 | "selectionChange"], | 244 | "selectionChange"], |
213 | i, | 245 | i, |
214 | arrEventsLength = arrEvents.length; | 246 | arrEventsLength = arrEvents.length; |
@@ -221,6 +253,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
221 | for (i = 0; i < arrEventsLength; i++) { | 253 | for (i = 0; i < arrEventsLength; i++) { |
222 | this.eventManager.addEventListener(arrEvents[i], this, false); | 254 | this.eventManager.addEventListener(arrEvents[i], this, false); |
223 | } | 255 | } |
256 | Object.defineBinding(this, "breadCrumbContainer", { | ||
257 | boundObject: this.application.ninja, | ||
258 | boundObjectPropertyPath:"currentSelectedContainer", | ||
259 | oneway: true | ||
260 | }); | ||
224 | } | 261 | } |
225 | } | 262 | } |
226 | }, | 263 | }, |
@@ -247,8 +284,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
247 | value:function () { | 284 | value:function () { |
248 | var myIndex; | 285 | var myIndex; |
249 | this.drawTimeMarkers(); | 286 | this.drawTimeMarkers(); |
250 | this._hashKey = "123"; | 287 | |
251 | |||
252 | // Document switching | 288 | // Document switching |
253 | // Check to see if we have saved timeline information in the currentDocument. | 289 | // Check to see if we have saved timeline information in the currentDocument. |
254 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { | 290 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { |
@@ -257,50 +293,60 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
257 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 293 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
258 | this.application.ninja.currentDocument.tlArrLayers = []; | 294 | this.application.ninja.currentDocument.tlArrLayers = []; |
259 | this.application.ninja.currentDocument.tlArrTracks = []; | 295 | this.application.ninja.currentDocument.tlArrTracks = []; |
260 | 296 | this.application.ninja.currentDocument.tllayerNumber = 0; | |
261 | 297 | this.application.ninja.currentDocument.tlLayerHashTable=[]; | |
298 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; | ||
299 | |||
262 | // Loop through the DOM of the document to find layers and animations. | 300 | // Loop through the DOM of the document to find layers and animations. |
263 | // Fire off events as they are found. | 301 | // Fire off events as they are found. |
264 | _firstLayerDraw = false; | ||
265 | if(!this.application.ninja.documentController.creatingNewFile){ | 302 | if(!this.application.ninja.documentController.creatingNewFile){ |
266 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ | 303 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ |
267 | myIndex=0; | 304 | myIndex=0; |
268 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) | 305 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) |
269 | { | 306 | { |
270 | this._openDoc=true; | 307 | this._openDoc=true; |
271 | NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) | 308 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); |
272 | myIndex++; | 309 | myIndex++; |
273 | } | 310 | } |
274 | } | 311 | } |
275 | else{ | 312 | else{ |
276 | NJevent('newLayer', this._hashKey); | 313 | this.restoreLayer(1); |
277 | this.selectLayer(0); | 314 | this.selectLayer(0); |
278 | } | 315 | } |
279 | }else{ | 316 | }else{ |
280 | NJevent('newLayer', this._hashKey); | 317 | this.createNewLayer(1); |
281 | this.selectLayer(0); | 318 | this.selectLayer(0); |
282 | 319 | ||
283 | } | 320 | } |
284 | _firstLayerDraw = true; | ||
285 | |||
286 | // After recreating the tracks and layers, store the result in the currentDocument. | 321 | // After recreating the tracks and layers, store the result in the currentDocument. |
287 | this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; | ||
288 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 322 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
323 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | ||
324 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; | ||
325 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; | ||
326 | this.application.ninja.currentDocument.hashKey=this.hashKey; | ||
327 | |||
328 | |||
289 | 329 | ||