diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 260 |
1 files changed, 143 insertions, 117 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index cd7622b1..350c7311 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:{ |
@@ -234,39 +248,39 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
234 | }, | 248 | }, |
235 | /* === END: Draw cycle === */ | 249 | /* === END: Draw cycle === */ |
236 | /* === BEGIN: Controllers === */ | 250 | /* === BEGIN: Controllers === */ |
237 | // Bind all document-specific events (pass in true to unbind) | 251 | // Bind all document-specific events (pass in true to unbind) |
238 | _bindDocumentEvents : { | 252 | _bindDocumentEvents : { |
239 | value: function(boolUnbind) { | 253 | value: function(boolUnbind) { |
240 | var arrEvents = ["deleteLayerClick", | 254 | var arrEvents = ["deleteLayerClick", |
241 | "newLayer", | 255 | "newLayer", |
242 | "deleteLayer", | 256 | "deleteLayer", |
243 | "elementAdded", | 257 | "elementAdded", |
244 | "elementDeleted", | 258 | "elementDeleted", |
245 | "selectionChange"], | 259 | "selectionChange"], |
246 | i, | 260 | i, |
247 | arrEventsLength = arrEvents.length; | 261 | arrEventsLength = arrEvents.length; |
248 | 262 | ||
249 | if (boolUnbind) { | 263 | if (boolUnbind) { |
250 | for (i = 0; i < arrEventsLength; i++) { | 264 | for (i = 0; i < arrEventsLength; i++) { |
251 | this.eventManager.removeEventListener(arrEvents[i], this, false); | 265 | this.eventManager.removeEventListener(arrEvents[i], this, false); |
252 | } | 266 | } |
253 | } else { | 267 | } else { |
254 | for (i = 0; i < arrEventsLength; i++) { | 268 | for (i = 0; i < arrEventsLength; i++) { |
255 | this.eventManager.addEventListener(arrEvents[i], this, false); | 269 | this.eventManager.addEventListener(arrEvents[i], this, false); |
256 | } | 270 | } |
257 | Object.defineBinding(this, "breadCrumbContainer", { | 271 | Object.defineBinding(this, "breadCrumbContainer", { |
258 | boundObject: this.application.ninja, | 272 | boundObject: this.application.ninja, |
259 | boundObjectPropertyPath:"currentSelectedContainer", | 273 | boundObjectPropertyPath:"currentSelectedContainer", |
260 | oneway: true | 274 | oneway: true |
261 | }); | 275 | }); |
262 | } | 276 | } |
263 | } | 277 | } |
264 | }, | 278 | }, |
265 | 279 | ||
266 | initTimeline : { | 280 | initTimeline : { |
267 | value: function() { | 281 | value: function() { |
268 | // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once. | 282 | // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once. |
269 | this.layout_tracks = this.element.querySelector(".layout-tracks"); | 283 | this.layout_tracks = this.element.querySelector(".layout-tracks"); |
270 | this.layout_markers = this.element.querySelector(".layout_markers"); | 284 | this.layout_markers = this.element.querySelector(".layout_markers"); |
271 | 285 | ||
272 | this.newlayer_button.identifier = "addLayer"; | 286 | this.newlayer_button.identifier = "addLayer"; |
@@ -280,73 +294,74 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
280 | this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); | 294 | this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); |
281 | this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); | 295 | this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); |
282 | this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); | 296 | this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); |
283 | } | 297 | } |
284 | }, | 298 | }, |
285 | 299 | ||
286 | initTimelineForDocument:{ | 300 | initTimelineForDocument:{ |
287 | value:function () { | 301 | value:function () { |
288 | var myIndex; | 302 | var myIndex; |
289 | this.drawTimeMarkers(); | 303 | this.drawTimeMarkers(); |
290 | // Document switching | 304 | // Document switching |
291 | // Check to see if we have saved timeline information in the currentDocument. | 305 | // Check to see if we have saved timeline information in the currentDocument. |
292 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { | 306 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { |
293 | // No, we have no information stored. Create it. | 307 | // No, we have no information stored. Create it. |
294 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 308 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
295 | this.application.ninja.currentDocument.tlArrLayers = []; | 309 | this.application.ninja.currentDocument.tlArrLayers = []; |
296 | this.application.ninja.currentDocument.tllayerNumber = 0; | 310 | this.application.ninja.currentDocument.tllayerNumber = 0; |
297 | this.application.ninja.currentDocument.tlLayerHashTable=[]; | 311 | this.application.ninja.currentDocument.tlLayerHashTable=[]; |
298 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; | 312 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; |
299 | 313 | ||
300 | // Loop through the DOM of the document to find layers and animations. | 314 | // Loop through the DOM of the document to find layers and animations. |
301 | // Fire off events as they are found. | 315 | // Fire off events as they are found. |
302 | if(!this.application.ninja.documentController.creatingNewFile){ | 316 | if(!this.application.ninja.documentController.creatingNewFile){ |
303 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ | 317 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ |
304 | myIndex=0; | 318 | myIndex=0; |
305 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) | 319 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) |
306 | { | 320 | { |
307 | this._openDoc=true; | 321 | this._openDoc=true; |
308 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); | 322 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); |
309 | myIndex++; | 323 | myIndex++; |
310 | } | 324 | } |
311 | } | 325 | } |
312 | else{ | 326 | else{ |
313 | this.restoreLayer(1); | 327 | this.restoreLayer(1); |
314 | this.selectLayer(0); | 328 | this.selectLayer(0); |
315 | } | 329 | } |
316 | }else{ | 330 | }else{ |
317 | this.createNewLayer(1); | 331 | this.createNewLayer(1); |
318 | this.selectLayer(0); | 332 | this.selectLayer(0); |
319 | 333 | ||
320 | } | 334 | } |
321 | // After recreating the tracks and layers, store the result in the currentDocument. | 335 | // After recreating the tracks and layers, store the result in the currentDocument. |
322 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 336 | this.arrLayers=this.temparrLayers; |
337 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | ||
323 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 338 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
324 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; | 339 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; |
325 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; | 340 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; |
326 | this.application.ninja.currentDocument.hashKey=this.hashKey; | 341 | this.application.ninja.currentDocument.hashKey=this.hashKey; |
327 | } else { | 342 | } else { |
328 | // we do have information stored. Use it. | 343 | // we do have information stored. Use it. |
329 | this._boolCacheArrays = false; | 344 | this._boolCacheArrays = false; |
330 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; | 345 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; |
331 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 346 | this.currentLayerNumber = |