aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js39
1 files changed, 32 insertions, 7 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 89d5e258..48bce268 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -312,7 +312,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
312 this.initTimeline(); 312 this.initTimeline();
313 // Bind the event handler for the document change events 313 // Bind the event handler for the document change events
314 this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false); 314 this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false);
315 this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false); 315 //this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false);
316 this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false); 316 this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false);
317 317
318 // Bind drag and drop event handlers 318 // Bind drag and drop event handlers
@@ -502,6 +502,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
502 for (i = 0; i < arrEventsLength; i++) { 502 for (i = 0; i < arrEventsLength; i++) {
503 this.eventManager.removeEventListener(arrEvents[i], this, false); 503 this.eventManager.removeEventListener(arrEvents[i], this, false);
504 } 504 }
505 if (this._bindingDescriptors !== null) {
506 //console.log('Unbinding breadcrumbcontainer')
507 Object.deleteBinding(this, "breadCrumbContainer");
508 }
505 } else { 509 } else {
506 for (i = 0; i < arrEventsLength; i++) { 510 for (i = 0; i < arrEventsLength; i++) {
507 this.eventManager.addEventListener(arrEvents[i], this, false); 511 this.eventManager.addEventListener(arrEvents[i], this, false);
@@ -532,6 +536,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
532 // Initialize BreadCrumb 536 // Initialize BreadCrumb
533 this.application.ninja.breadCrumbClick = false; 537 this.application.ninja.breadCrumbClick = false;
534 this.enablePanel(false); 538 this.enablePanel(false);
539
540 /*
541 Object.defineBinding(this, "breadCrumbContainer", {
542 boundObject:this.application.ninja,
543 boundObjectPropertyPath:"currentSelectedContainer",
544 oneway:true
545 });
546 */
535 } 547 }
536 }, 548 },
537 549
@@ -539,12 +551,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
539 // Called when a document is opened (new or existing), or when documents are switched. 551 // Called when a document is opened (new or existing), or when documents are switched.
540 initTimelineForDocument:{ 552 initTimelineForDocument:{
541 value:function () { 553 value:function () {
542 var myIndex; 554 var myIndex,
555 boolAlreadyInitialized = false;
543 this.drawTimeMarkers(); 556 this.drawTimeMarkers();
544 // Document switching 557 // Document switching
545 // Check to see if we have saved timeline information in the currentDocument. 558 // Check to see if we have saved timeline information in the currentDocument.
546 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") && 559 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") &&
547 (!this.application.ninja.breadCrumbClick)) { 560 (!this.application.ninja.breadCrumbClick)) {
561 //console.log('TimelinePanel.initTimelineForDocument: new Document');
548 // No, we have no information stored. 562 // No, we have no information stored.
549 // This could mean we are creating a new file, OR are opening an existing file. 563 // This could mean we are creating a new file, OR are opening an existing file.
550 564
@@ -568,8 +582,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
568 // Draw the repetition. 582 // Draw the repetition.
569 this.arrLayers = this.temparrLayers; 583 this.arrLayers = this.temparrLayers;
570 this.currentLayerNumber = this.arrLayers.length; 584 this.currentLayerNumber = this.arrLayers.length;
585 boolAlreadyInitialized = true;
571 586
572 } else if (this.application.ninja.breadCrumbClick) { 587 } else if (this.application.ninja.breadCrumbClick) {
588 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick');
573 // Information stored, but we're moving up or down in the breadcrumb. 589 // Information stored, but we're moving up or down in the breadcrumb.
574 // Get the current selection and restore timeline info for its children. 590 // Get the current selection and restore timeline info for its children.
575 var parentNode = this.application.ninja.currentSelectedContainer, 591 var parentNode = this.application.ninja.currentSelectedContainer,
@@ -586,8 +602,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
586 this.currentLayerNumber = storedCurrentLayerNumber; 602 this.currentLayerNumber = storedCurrentLayerNumber;
587 this.currentLayerSelected = this.application.ninja.currentSelectedContainer; 603 this.currentLayerSelected = this.application.ninja.currentSelectedContainer;
588 // this.application.ninja.breadCrumbClick = false; 604 // this.application.ninja.breadCrumbClick = false;
605 boolAlreadyInitialized = true;
589 606
590 } else { 607 } else {
608 //console.log('TimelinePanel.initTimelineForDocument: else fallback');
591 // we do have information stored. Use it. 609 // we do have information stored. Use it.
592 var i = 0, 610 var i = 0,
593 tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; 611 tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length;
@@ -621,6 +639,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
621 639
622 // Ok, done reading from the cache. 640 // Ok, done reading from the cache.
623 this._boolCacheArrays = true; 641 this._boolCacheArrays = true;
642
643 // Reset master duration
644 this.resetMasterDuration();
624 } 645 }
625 } 646 }
626 }, 647 },
@@ -661,6 +682,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
661 handleDocumentChange:{ 682 handleDocumentChange:{
662 value:function (event) { 683 value:function (event) {
663 // Clear the timeline but not the cache 684 // Clear the timeline but not the cache
685 //console.log('TimelinePanel.handleDocumentChange')
664 this._boolCacheArrays = false; 686 this._boolCacheArrays = false;
665 this.clearTimelinePanel(); 687 this.clearTimelinePanel();
666 this._boolCacheArrays = true; 688 this._boolCacheArrays = true;
@@ -672,6 +694,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
672 if (this.application.ninja.documentController._documents.length > 0) { 694 if (this.application.ninja.documentController._documents.length > 0) {
673 this.enablePanel(true); 695 this.enablePanel(true);
674 this.initTimelineForDocument(); 696 this.initTimelineForDocument();
697
675 } else { 698 } else {
676 this.enablePanel(false); 699 this.enablePanel(false);
677 } 700 }
@@ -750,15 +773,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
750 773
751 LayerBinding:{ 774 LayerBinding:{
752 value:function (node) { 775 value:function (node) {
753 var i = 0; 776 // var i = 0;
754 777 /*
755 if (this._firstTimeLoaded === true) { 778 if (this._firstTimeLoaded === true) {
756 this._firstTimeLoaded = false; 779 this._firstTimeLoaded = false;
757 return; 780 return;
758 } 781 }
759 782 */
760 this.handleDocumentChange(); 783 if (this.application.ninja.breadCrumbClick === true) {
761 // this.application.ninja.breadCrumbClick=false; 784 //console.log('TimelinePanel.LayerBinding: firing this.handleDocumentChange')
785 this.handleDocumentChange();
786 }
762 } 787 }
763 }, 788 },
764 789