diff options
author | Kruti Shah | 2012-03-08 14:26:37 -0800 |
---|---|---|
committer | Kruti Shah | 2012-03-08 14:26:37 -0800 |
commit | b113b764d1522cf18d823c22ee7bd0bfc25ca875 (patch) | |
tree | fc65b886793da4e58e36df25e749ab212b257028 | |
parent | b4aa9a46bdf6ed748cbb3fc2a2a4fc226e0e7fd7 (diff) | |
download | ninja-b113b764d1522cf18d823c22ee7bd0bfc25ca875.tar.gz |
Timeline : Changing the order of the arrLayers being built
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 292 |
1 files changed, 159 insertions, 133 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 0185d448..ce52d1f3 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -32,6 +32,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
32 | } | 32 | } |
33 | }, | 33 | }, |
34 | 34 | ||
35 | _temparrLayers:{ | ||
36 | value:[] | ||
37 | }, | ||
38 | |||
39 | temparrLayers:{ | ||
40 | get:function () { | ||
41 | return this._temparrLayers; | ||
42 | }, | ||
43 | set:function (newVal) { | ||
44 | this._temparrLayers = newVal; | ||
45 | } | ||
46 | }, | ||
47 | |||
48 | |||
35 | _layerRepetition:{ | 49 | _layerRepetition:{ |
36 | value:null | 50 | value:null |
37 | }, | 51 | }, |
@@ -46,17 +60,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
46 | }, | 60 | }, |
47 | 61 | ||
48 | _cacheArrays : { | 62 | _cacheArrays : { |
49 | value: function() { | 63 | value: function() { |
50 | if (this._boolCacheArrays) { | 64 | if (this._boolCacheArrays) { |
51 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 65 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
52 | 66 | ||
53 | } | 67 | } |
54 | } | 68 | } |
55 | }, | 69 | }, |
56 | 70 | ||
57 | // Set to false to skip array caching array sets in current document | 71 | // Set to false to skip array caching array sets in current document |
58 | _boolCacheArrays : { | 72 | _boolCacheArrays : { |
59 | value: true | 73 | value: true |
60 | }, | 74 | }, |
61 | 75 | ||
62 | _currentLayerNumber:{ | 76 | _currentLayerNumber:{ |
@@ -233,39 +247,39 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
233 | }, | 247 | }, |
234 | /* === END: Draw cycle === */ | 248 | /* === END: Draw cycle === */ |
235 | /* === BEGIN: Controllers === */ | 249 | /* === BEGIN: Controllers === */ |
236 | // Bind all document-specific events (pass in true to unbind) | 250 | // Bind all document-specific events (pass in true to unbind) |
237 | _bindDocumentEvents : { | 251 | _bindDocumentEvents : { |
238 | value: function(boolUnbind) { | 252 | value: function(boolUnbind) { |
239 | var arrEvents = ["deleteLayerClick", | 253 | var arrEvents = ["deleteLayerClick", |
240 | "newLayer", | 254 | "newLayer", |
241 | "deleteLayer", | 255 | "deleteLayer", |
242 | "elementAdded", | 256 | "elementAdded", |
243 | "elementDeleted", | 257 | "elementDeleted", |
244 | "selectionChange"], | 258 | "selectionChange"], |
245 | i, | 259 | i, |
246 | arrEventsLength = arrEvents.length; | 260 | arrEventsLength = arrEvents.length; |
247 | 261 | ||
248 | if (boolUnbind) { | 262 | if (boolUnbind) { |
249 | for (i = 0; i < arrEventsLength; i++) { | 263 | for (i = 0; i < arrEventsLength; i++) { |
250 | this.eventManager.removeEventListener(arrEvents[i], this, false); | 264 | this.eventManager.removeEventListener(arrEvents[i], this, false); |
251 | } | 265 | } |
252 | } else { | 266 | } else { |
253 | for (i = 0; i < arrEventsLength; i++) { | 267 | for (i = 0; i < arrEventsLength; i++) { |
254 | this.eventManager.addEventListener(arrEvents[i], this, false); | 268 | this.eventManager.addEventListener(arrEvents[i], this, false); |
255 | } | 269 | } |
256 | Object.defineBinding(this, "breadCrumbContainer", { | 270 | Object.defineBinding(this, "breadCrumbContainer", { |
257 | boundObject: this.application.ninja, | 271 | boundObject: this.application.ninja, |
258 | boundObjectPropertyPath:"currentSelectedContainer", | 272 | boundObjectPropertyPath:"currentSelectedContainer", |
259 | oneway: true | 273 | oneway: true |
260 | }); | 274 | }); |
261 | } | 275 | } |
262 | } | 276 | } |
263 | }, | 277 | }, |
264 | 278 | ||
265 | initTimeline : { | 279 | initTimeline : { |
266 | value: function() { | 280 | value: function() { |
267 | // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once. | 281 | // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once. |
268 | this.layout_tracks = this.element.querySelector(".layout-tracks"); | 282 | this.layout_tracks = this.element.querySelector(".layout-tracks"); |
269 | this.layout_markers = this.element.querySelector(".layout_markers"); | 283 | this.layout_markers = this.element.querySelector(".layout_markers"); |
270 | 284 | ||
271 | this.newlayer_button.identifier = "addLayer"; | 285 | this.newlayer_button.identifier = "addLayer"; |
@@ -279,73 +293,74 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
279 | this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); | 293 | this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); |
280 | this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); | 294 | this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); |
281 | this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); | 295 | this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); |
282 | } | 296 | } |
283 | }, | 297 | }, |
284 | 298 | ||
285 | initTimelineForDocument:{ | 299 | initTimelineForDocument:{ |
286 | value:function () { | 300 | value:function () { |
287 | var myIndex; | 301 | var myIndex; |
288 | this.drawTimeMarkers(); | 302 | this.drawTimeMarkers(); |
289 | // Document switching | 303 | // Document switching |
290 | // Check to see if we have saved timeline information in the currentDocument. | 304 | // Check to see if we have saved timeline information in the currentDocument. |
291 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { | 305 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { |
292 | // No, we have no information stored. Create it. | 306 | // No, we have no information stored. Create it. |
293 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 307 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
294 | this.application.ninja.currentDocument.tlArrLayers = []; | 308 | this.application.ninja.currentDocument.tlArrLayers = []; |
295 | this.application.ninja.currentDocument.tllayerNumber = 0; | 309 | this.application.ninja.currentDocument.tllayerNumber = 0; |
296 | this.application.ninja.currentDocument.tlLayerHashTable=[]; | 310 | this.application.ninja.currentDocument.tlLayerHashTable=[]; |
297 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; | 311 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; |
298 | 312 | ||
299 | // Loop through the DOM of the document to find layers and animations. | 313 | // Loop through the DOM of the document to find layers and animations. |
300 | // Fire off events as they are found. | 314 | // Fire off events as they are found. |
301 | if(!this.application.ninja.documentController.creatingNewFile){ | 315 | if(!this.application.ninja.documentController.creatingNewFile){ |
302 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ | 316 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ |
303 | myIndex=0; | 317 | myIndex=0; |
304 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) | 318 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) |
305 | { | 319 | { |
306 | this._openDoc=true; | 320 | this._openDoc=true; |
307 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); | 321 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); |
308 | myIndex++; | 322 | myIndex++; |
309 | } | 323 | } |
310 | } | 324 | } |
311 | else{ | 325 | else{ |
312 | this.restoreLayer(1); | 326 | this.restoreLayer(1); |
313 | this.selectLayer(0); | 327 | this.selectLayer(0); |
314 | } | 328 | } |
315 | }else{ | 329 | }else{ |
316 | this.createNewLayer(1); | 330 | this.createNewLayer(1); |
317 | this.selectLayer(0); | 331 | this.selectLayer(0); |
318 | 332 | ||
319 | } | 333 | } |
320 | // After recreating the tracks and layers, store the result in the currentDocument. | 334 | // After recreating the tracks and layers, store the result in the currentDocument. |
321 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 335 | this.arrLayers=this.temparrLayers; |
336 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | ||
322 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 337 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
323 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; | 338 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; |
324 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; | 339 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; |
325 | this.application.ninja.currentDocument.hashKey=this.hashKey; | 340 | this.application.ninja.currentDocument.hashKey=this.hashKey; |
326 | } else { | 341 | } else { |
327 | // we do have information stored. Use it. | 342 | // we do have information stored. Use it. |
328 | this._boolCacheArrays = false; | 343 | this._boolCacheArrays = false; |
329 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; | 344 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; |
330 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 345 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
331 | this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable; |