aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
authorJon Reid2012-04-13 10:39:01 -0700
committerJon Reid2012-04-13 10:39:01 -0700
commitdfe348652aa5a54b25dbe0d8249bc289efb31e21 (patch)
treedde0e6789c4e41eb42f6ed31a67141d6bfc02b2f /js/panels/Timeline
parent0ad7d35c97dfecc73618d7e34f814487cca4d933 (diff)
downloadninja-dfe348652aa5a54b25dbe0d8249bc289efb31e21.tar.gz
Timeline: More bug fixes for document switching.
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js65
1 files changed, 37 insertions, 28 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 85ea7d2e..a69f131d 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -158,8 +158,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
158 return this._masterDuration; 158 return this._masterDuration;
159 }, 159 },
160 set:function (val) { 160 set:function (val) {
161 console.log('timelinepanel.masterDuration.set('+val+')');
162 //debugger;
163 this._masterDuration = val; 161 this._masterDuration = val;
164 this.timebar.style.width = (this._masterDuration / 12) + "px"; 162 this.timebar.style.width = (this._masterDuration / 12) + "px";
165 } 163 }
@@ -455,14 +453,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
455 newStyle = {}, 453 newStyle = {},
456 styleID = "1@0"; // format: layerID + "@" + style counter 454 styleID = "1@0"; // format: layerID + "@" + style counter
457 455
456 /* Example new style
458 newStyle.styleID = styleID; 457 newStyle.styleID = styleID;
459 newStyle.whichView = "propval"; 458 newStyle.whichView = "propval"; // Which view do we want to show, usually property/value view (see Style)
460 newStyle.editorProperty = "top"; 459 newStyle.editorProperty = "top"; // the style property
461 newStyle.editorValue = 0; 460 newStyle.editorValue = 0; // The current value
462 newStyle.ruleTweener = false; 461 newStyle.ruleTweener = false;
463 newStyle.isSelected = false; 462 newStyle.isSelected = false;
464 463
465 returnArray.push(newStyle); 464 returnArray.push(newStyle);
465 */
466 466
467 return returnArray; 467 return returnArray;
468 468
@@ -542,35 +542,48 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
542 this.drawTimeMarkers(); 542 this.drawTimeMarkers();
543 // Document switching 543 // Document switching
544 // Check to see if we have saved timeline information in the currentDocument. 544 // Check to see if we have saved timeline information in the currentDocument.
545 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined" || this.application.ninja.breadCrumbClick) { 545 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
546 // No, we have no information stored. Create it. 546 // No, we have no information stored.
547 // This could mean we are creating a new file, OR are opening an existing file.
548
549 // First, initialize the caches.
547 this.initTimelineCache(); 550 this.initTimelineCache();
548 this.temparrLayers = []; 551 this.temparrLayers = [];
549 552
550 // Are we opening an existing doc? 553 // That's all we need to do for a brand new file.
554 // But what if we're opening an existing document?
551 if (!this.application.ninja.documentController.creatingNewFile) { 555 if (!this.application.ninja.documentController.creatingNewFile) {
552 // Opening an existing document. Does it have any DOM elements? 556 // Opening an existing document. If it has DOM elements we need to restore their timeline info
553 if(this.application.ninja.breadCrumbClick){ 557 if (this.application.ninja.currentDocument.documentRoot.children[0]) {
554 var parentNode = this.application.ninja.currentSelectedContainer;
555 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) {
556 this._openDoc = true;
557 this.restoreLayer(parentNode.children[myIndex]);
558 }
559 this.resetMasterDuration();
560 }else if (this.application.ninja.currentDocument.documentRoot.children[0]) {
561 // Yes, it has DOM elements. Loop through them and create a new object for each. 558 // Yes, it has DOM elements. Loop through them and create a new object for each.
562 for (myIndex = 0; this.application.ninja.currentDocument.documentRoot.children[myIndex]; myIndex++) { 559 for (myIndex = 0; this.application.ninja.currentDocument.documentRoot.children[myIndex]; myIndex++) {
563 this._openDoc = true; 560 this._openDoc = true;
564 this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); 561 this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]);
565 } 562 }
566 } 563 }
567 // }else if(this.application.ninja.breadCrumbClick){
568 } 564 }
569 565
570 // After recreating the tracks and layers, store the result in the currentDocument. 566 // Draw the repetition.
571 this.arrLayers = this.temparrLayers; 567 this.arrLayers = this.temparrLayers;
572 this.cacheTimeline(); 568 this.currentLayerNumber = this.arrLayers.length;
573 569
570 } else if (this.application.ninja.breadCrumbClick) {
571 // Information stored, but we're moving up or down in the breadcrumb.
572 // Get the current selection and restore timeline info for its children.
573 var parentNode = this.application.ninja.currentSelectedContainer,
574 storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
575 this.temparrLayers = [];
576
577 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) {
578 this._openDoc = true;
579 this.restoreLayer(parentNode.children[myIndex]);
580 }
581
582 // Draw the repetition.
583 this.arrLayers = this.temparrLayers;
584 this.currentLayerNumber = storedCurrentLayerNumber;
585 this.currentLayerSelected = this.application.ninja.currentSelectedContainer;
586
574 } else { 587 } else {
575 // we do have information stored. Use it. 588 // we do have information stored. Use it.
576 var i = 0, 589 var i = 0,
@@ -605,7 +618,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
605 618
606 // Ok, done reading from the cache. 619 // Ok, done reading from the cache.
607 this._boolCacheArrays = true; 620 this._boolCacheArrays = true;
608 this.resetMasterDuration();
609 } 621 }
610 } 622 }
611 }, 623 },
@@ -759,7 +771,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
759 var ptrParent = nj.queryParentSelector(event.target, ".container-layer"); 771 var ptrParent = nj.queryParentSelector(event.target, ".container-layer");
760 if (ptrParent !== false) { 772 if (ptrParent !== false) {
761 var myIndex = this.getActiveLayerIndex(); 773 var myIndex = this.getActiveLayerIndex();
762 console.log('timelinePanel.timelineLeftPaneMousedown, myIndex = ' + myIndex)
763 if (myIndex !== false) { 774 if (myIndex !== false) {
764 this.selectLayer(myIndex, true); 775 this.selectLayer(myIndex, true);
765 } 776 }
@@ -878,8 +889,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
878 889
879 resetMasterDuration:{ 890 resetMasterDuration:{
880 value:function(){ 891 value:function(){
881 console.log('TimelinePanel.resetMasterDuration()')
882
883 var trackDuration; 892 var trackDuration;
884 var length = this.arrLayers.length; 893 var length = this.arrLayers.length;
885 if (length > 0) { 894 if (length > 0) {