aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js89
1 files changed, 64 insertions, 25 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 92c0766b..4eed6af8 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -193,6 +193,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
193 } 193 }
194 }, 194 },
195 195
196 _breadCrumbContainer:{
197 value:null
198 },
199
200 breadCrumbContainer:{
201 get:function () {
202 return this._breadCrumbContainer;
203 },
204 set:function (value) {
205 if (this._breadCrumbContainer !== value) {
206 this._breadCrumbContainer = value;
207 this.LayerBinding();
208 }
209 }
210 },
211
196 _isLayer:{ 212 _isLayer:{
197 value:false 213 value:false
198 }, 214 },
@@ -485,6 +501,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
485 this.eventManager.addEventListener(arrEvents[i], this, false); 501 this.eventManager.addEventListener(arrEvents[i], this, false);
486 } 502 }
487 503
504 Object.defineBinding(this, "breadCrumbContainer", {
505 boundObject:this.application.ninja,
506 boundObjectPropertyPath:"currentSelectedContainer",
507 oneway:true
508 });
509
488 } 510 }
489 } 511 }
490 }, 512 },
@@ -504,7 +526,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
504 this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); 526 this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false);
505 527
506 // Initialize BreadCrumb 528 // Initialize BreadCrumb
507 this.application.ninja.breadCrumbClick = false; 529
508 this.enablePanel(false); 530 this.enablePanel(false);
509 531
510 } 532 }
@@ -514,17 +536,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
514 // Called when a document is opened (new or existing), or when documents are switched. 536 // Called when a document is opened (new or existing), or when documents are switched.
515 initTimelineForDocument:{ 537 initTimelineForDocument:{
516 value:function () { 538 value:function () {
517 if(this.application.ninja.currentDocument.breadCrumbClick === undefined){ 539
518 this.application.ninja.currentDocument.breadCrumbClick = false; 540
519 }
520 var myIndex, 541 var myIndex,
521 boolAlreadyInitialized = false; 542 boolAlreadyInitialized = false;
522 this.drawTimeMarkers(); 543 this.drawTimeMarkers();
523 // Document switching 544 // Document switching
524 // Check to see if we have saved timeline information in the currentDocument. 545 // Check to see if we have saved timeline information in the currentDocument.
525 //debugger; 546 debugger;
526 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") && 547 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) {
527 (!this.application.ninja.currentDocument.breadCrumbClick)) {
528 //console.log('TimelinePanel.initTimelineForDocument: new Document'); 548 //console.log('TimelinePanel.initTimelineForDocument: new Document');
529 // No, we have no information stored. 549 // No, we have no information stored.
530 // This could mean we are creating a new file, OR are opening an existing file. 550 // This could mean we are creating a new file, OR are opening an existing file.
@@ -551,7 +571,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
551 this.currentLayerNumber = this.arrLayers.length; 571 this.currentLayerNumber = this.arrLayers.length;
552 boolAlreadyInitialized = true; 572 boolAlreadyInitialized = true;
553 573
554 } else if (this.application.ninja.currentDocument.breadCrumbClick) { 574 } else if (this.application.ninja.currentDocument.setLevel) {
555 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); 575 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick');
556 // Information stored, but we're moving up or down in the breadcrumb. 576 // Information stored, but we're moving up or down in the breadcrumb.
557 // Get the current selection and restore timeline info for its children. 577 // Get the current selection and restore timeline info for its children.
@@ -561,15 +581,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
561 581
562 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) { 582 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) {
563 this._openDoc = true; 583 this._openDoc = true;
564 this.application.ninja.currentDocument.breadCrumbClick = false;
565 this.restoreLayer(parentNode.children[myIndex]); 584 this.restoreLayer(parentNode.children[myIndex]);
566 585
567 } 586 }
568 this.application.ninja.currentDocument.breadCrumbClick = false;
569 // Draw the repetition. 587 // Draw the repetition.
570 this.arrLayers = this.temparrLayers; 588 this.arrLayers = this.temparrLayers;
571 this.currentLayerNumber = storedCurrentLayerNumber; 589 this.currentLayerNumber = storedCurrentLayerNumber;
572 boolAlreadyInitialized = true; 590 boolAlreadyInitialized = true;
591 this.application.ninja.currentDocument.setLevel = false;
592
573 593
574 } else { 594 } else {
575 //console.log('TimelinePanel.initTimelineForDocument: else fallback'); 595 //console.log('TimelinePanel.initTimelineForDocument: else fallback');
@@ -590,6 +610,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
590 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 610 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
591 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; 611 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected;
592 612
613
614 debugger;
593 if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") { 615 if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") {
594 this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer; 616 this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer;
595 } 617 }
@@ -601,7 +623,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
601 evt.initMouseEvent("click"); 623 evt.initMouseEvent("click");
602 this.checkable_animated.dispatchEvent(evt); 624 this.checkable_animated.dispatchEvent(evt);
603 } 625 }
604 626
605 // Ok, done reading from the cache. 627 // Ok, done reading from the cache.
606 this._boolCacheArrays = true; 628 this._boolCacheArrays = true;
607 629
@@ -648,6 +670,27 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
648 value:function (event) { 670 value:function (event) {
649 // Clear the timeline but not the cache 671 // Clear the timeline but not the cache
650 //console.log('TimelinePanel.handleDocumentChange'); 672 //console.log('TimelinePanel.handleDocumentChange');
673// debugger;
674 if(event === undefined){
675 this.application.ninja.currentDocument.setLevel = true;
676 this._boolCacheArrays = false;
677 this.clearTimelinePanel();
678 this._boolCacheArrays = true;
679
680 // Rebind the document events for the new document context
681 this._bindDocumentEvents();
682
683 // Reinitialize the timeline...but only if there are open documents.
684 if (this.application.ninja.documentController._documents.length > 0) {
685 this.enablePanel(true);
686 this.initTimelineForDocument();
687
688 } else {
689 this.enablePanel(false);
690 }
691
692 return;
693 }
651 if ((event.type === "closeDocument") && (this.application.ninja.documentController._documents.length > 0)) { 694 if ((event.type === "closeDocument") && (this.application.ninja.documentController._documents.length > 0)) {
652 // Ignore extra closeDocument event that fires while there are still documents open. 695 // Ignore extra closeDocument event that fires while there are still documents open.
653 return; 696 return;
@@ -670,24 +713,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
670 } 713 }
671 }, 714 },
672 715
673 handleBreadCrumbBinding:{ 716 LayerBinding:{
674 value:function(event){ 717 value:function (node) {
675 // Might fire if currentDocument has not yet been initialized. 718 var i = 0;
676 if (this.application.ninja.currentDocument == null) { 719
677 return; 720 if(this._firstTimeLoaded){
678 } 721 this._firstTimeLoaded = false;
679 // Might fire if currentDocument is initialized but cache has not been initialized 722 return;
680 if(typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
681 return;
682 }
683
684 // If the breadCrumb has been clicked, we need to change documents.
685 if(this.application.ninja.currentDocument.breadCrumbClick){
686 this.handleDocumentChange(event);
687 } 723 }
724
725 this.handleDocumentChange(node);
688 } 726 }
689 }, 727 },
690 728
729
691 updateTrackContainerWidth:{ 730 updateTrackContainerWidth:{
692 value:function () {