aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorJon Reid2012-03-08 18:32:25 -0800
committerJon Reid2012-03-08 18:32:25 -0800
commit59d3aac11d2ba19f2541ef60064d01a2fd4fb75c (patch)
treef98ed86c47f8b8785985b0590e529289498ec3f6 /js/panels
parent02d44015dfbc407d2aa0d7e275fca91bea4bd65b (diff)
downloadninja-59d3aac11d2ba19f2541ef60064d01a2fd4fb75c.tar.gz
Timeline: Fixes for layer numbering problem, document switching events.
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html5
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js171
2 files changed, 90 insertions, 86 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html
index 0886bd6c..cf9bace6 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html
@@ -32,7 +32,8 @@
32 "timetext" : {"#": "time_text"}, 32 "timetext" : {"#": "time_text"},
33 "timebar" : {"#": "time_bar"}, 33 "timebar" : {"#": "time_bar"},
34 "container_tracks" : {"#" : "container-tracks"}, 34 "container_tracks" : {"#" : "container-tracks"},
35 "end_hottext" : {"@" : "endHottext"} 35 "end_hottext" : {"@" : "endHottext"},
36 "container_layers" : {"#" : "container-layers"}
36 } 37 }
37 }, 38 },
38 39
@@ -72,7 +73,7 @@
72 }, 73 },
73 "bindings" : { 74 "bindings" : {
74 "layerData" : { 75 "layerData" : {
75 "boundObject" : {"@" : "repetition2"}, 76 "boundObject" : {"@" : "repetition1"},
76 "boundObjectPropertyPath" : "objectAtCurrentIteration.layerData", 77 "boundObjectPropertyPath" : "objectAtCurrentIteration.layerData",
77 "oneway" : false 78 "oneway" : false
78 } 79 }
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 350c7311..0490aa49 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -19,15 +19,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
19 19
20 /* === BEGIN: Models === */ 20 /* === BEGIN: Models === */
21 _arrLayers:{ 21 _arrLayers:{
22 serializable: true,
22 value:[] 23 value:[]
23 }, 24 },
24 25
25 arrLayers:{ 26 arrLayers:{
27 serializable: true,
26 get:function () { 28 get:function () {
27 return this._arrLayers; 29 return this._arrLayers;
28 }, 30 },
29 set:function (newVal) { 31 set:function (newVal) {
30 this._arrLayers = newVal; 32 this._arrLayers = newVal;
33 this.needsDraw = true;
31 this._cacheArrays(); 34 this._cacheArrays();
32 } 35 }
33 }, 36 },
@@ -47,10 +50,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
47 50
48 51
49 _layerRepetition:{ 52 _layerRepetition:{
53 serializable: true,
50 value:null 54 value:null
51 }, 55 },
52 56
53 layerRepetition:{ 57 layerRepetition:{
58 serializable: true,
54 get:function () { 59 get:function () {
55 return this._layerRepetition; 60 return this._layerRepetition;
56 }, 61 },
@@ -248,6 +253,33 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
248 }, 253 },
249 /* === END: Draw cycle === */ 254 /* === END: Draw cycle === */
250 /* === BEGIN: Controllers === */ 255 /* === BEGIN: Controllers === */
256 // Create an empty layer template object with minimal defaults and return it for use
257 createLayerTemplate : {
258 value : function() {
259 var returnObj = {};
260 returnObj.layerData = {};
261 returnObj.layerData.layerName = null;
262 returnObj.layerData.layerID = null;
263 returnObj.layerData.isMainCollapsed = true;
264 returnObj.layerData.isPositionCollapsed = true;
265 returnObj.layerData.isTransformCollapsed = true;
266 returnObj.layerData.isStyleCollapsed = true;
267 returnObj.layerData.arrLayerStyles = [];
268 returnObj.layerData.elementsList = [];
269 returnObj.layerData.deleted = false;
270 returnObj.layerData.isSelected = false;
271 returnObj.layerData.layerPosition = null;
272 returnObj.layerData.created=false;
273 returnObj.layerData.isTrackAnimated = false;
274 returnObj.layerData.currentKeyframeRule = null;
275 returnObj.layerData.trackPosition = 0;
276 returnObj.layerData.arrStyleTracks = [];
277 returnObj.layerData.tweens = [];
278 returnObj.parentElementUUID = null;
279 returnObj.parentElement = null;
280 return returnObj;
281 }
282 },
251 // Bind all document-specific events (pass in true to unbind) 283 // Bind all document-specific events (pass in true to unbind)
252 _bindDocumentEvents : { 284 _bindDocumentEvents : {
253 value: function(boolUnbind) { 285 value: function(boolUnbind) {
@@ -309,27 +341,27 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
309 this.application.ninja.currentDocument.tlArrLayers = []; 341 this.application.ninja.currentDocument.tlArrLayers = [];
310 this.application.ninja.currentDocument.tllayerNumber = 0; 342 this.application.ninja.currentDocument.tllayerNumber = 0;
311 this.application.ninja.currentDocument.tlLayerHashTable=[]; 343 this.application.ninja.currentDocument.tlLayerHashTable=[];
344 this.temparrLayers = [];
312 this.hashKey = this.application.ninja.currentSelectedContainer.uuid; 345 this.hashKey = this.application.ninja.currentSelectedContainer.uuid;
313 346
314 // Loop through the DOM of the document to find layers and animations. 347 // Are we creating a new doc, or opening an existing one?
315 // Fire off events as they are found. 348 if(!this.application.ninja.documentController.creatingNewFile) {
316 if(!this.application.ninja.documentController.creatingNewFile){ 349 // Opening an existing document. Loop through the DOM and build the data model.
317 if(this.application.ninja.currentDocument.documentRoot.children[0]){ 350 if(this.application.ninja.currentDocument.documentRoot.children[0]) {
318 myIndex=0; 351 myIndex=0;
319 while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) 352 while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) {
320 {
321 this._openDoc=true; 353 this._openDoc=true;
322 this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); 354 this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]);
323 myIndex++; 355 myIndex++;
324 } 356 }
325 } 357 } else {
326 else{
327 this.restoreLayer(1); 358 this.restoreLayer(1);
328 this.selectLayer(0); 359 //this.selectLayer(0);
329 } 360 }
330 }else{ 361 } else {
362 // New document. Create default layer and select it.
331 this.createNewLayer(1); 363 this.createNewLayer(1);
332 this.selectLayer(0); 364 //this.selectLayer(0);
333 365
334 } 366 }
335 // After recreating the tracks and layers, store the result in the currentDocument. 367 // After recreating the tracks and layers, store the result in the currentDocument.
@@ -339,6 +371,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
339 this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; 371 this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance;
340 this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; 372 this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer;
341 this.application.ninja.currentDocument.hashKey=this.hashKey; 373 this.application.ninja.currentDocument.hashKey=this.hashKey;
374 //this.selectLayer(0);
342 } else { 375 } else {
343 // we do have information stored. Use it. 376 // we do have information stored. Use it.
344 this._boolCacheArrays = false; 377 this._boolCacheArrays = false;
@@ -347,9 +380,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
347 this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable; 380 this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable;
348 this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable; 381 this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable;
349 this.hashKey = this.application.ninja.currentDocument.hashKey; 382 this.hashKey = this.application.ninja.currentDocument.hashKey;
350 this.selectLayer(0);
351 this._boolCacheArrays = true; 383 this._boolCacheArrays = true;
384 //this.selectLayer(0);
352 } 385 }
386 // Select the first layer.
387 //debugger;
388 //this.selectLayer(0);
353 } 389 }
354 }, 390 },
355 391
@@ -367,10 +403,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
367 this.application.ninja.timeline.updateTimeText(0.00); 403 this.application.ninja.timeline.updateTimeText(0.00);
368 this.timebar.style.width = "0px"; 404 this.timebar.style.width = "0px";
369 405
370 // Clear variables--including repetitions. 406 // Clear variables.
371 this.hashInstance = null; 407 this.hashInstance = null;
372 this.hashElementMapToLayer = null; 408 this.hashElementMapToLayer = null;
373 this.arrLayers = [];
374 409
375 this.currentLayerNumber = 0; 410 this.currentLayerNumber = 0;
376 this.currentLayerSelected = false; 411 this.currentLayerSelected = false;