diff options
Diffstat (limited to 'js/panels')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 88 |
1 files changed, 55 insertions, 33 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 871a723b..a902d282 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -24,6 +24,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
24 | return this._currentDocument; | 24 | return this._currentDocument; |
25 | }, | 25 | }, |
26 | set : function(value) { | 26 | set : function(value) { |
27 | // If it's the same document, do nothing. | ||
27 | if (value === this._currentDocument) { | 28 | if (value === this._currentDocument) { |
28 | return; | 29 | return; |
29 | } | 30 | } |
@@ -35,6 +36,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
35 | this._currentDocument = value; | 36 | this._currentDocument = value; |
36 | 37 | ||
37 | if(!value) { | 38 | if(!value) { |
39 | this._boolCacheArrays = false; | ||
40 | this.clearTimelinePanel(); | ||
41 | this._boolCacheArrays = true; | ||
38 | this.enablePanel(false); | 42 | this.enablePanel(false); |
39 | } else if(this._currentDocument.currentView === "design") { | 43 | } else if(this._currentDocument.currentView === "design") { |
40 | this._boolCacheArrays = false; | 44 | this._boolCacheArrays = false; |
@@ -43,9 +47,40 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
43 | 47 | ||
44 | // Rebind the document events for the new document context | 48 | // Rebind the document events for the new document context |
45 | this._bindDocumentEvents(); | 49 | this._bindDocumentEvents(); |
46 | 50 | ||
47 | // TODO: Fix the init function so that it can be called here instead of when container changes | 51 | // Initialize the timeline for the document. |
48 | // this.initTimelineForDocument(); | 52 | this.initTimelineForDocument(); |
53 | } | ||
54 | } | ||
55 | }, | ||
56 | |||
57 | _currentSelectedContainer: { | ||
58 | value: null | ||
59 | }, | ||
60 | currentSelectedContainer: { | ||
61 | get: function() { | ||
62 | return this._currentSelectedContainer; | ||
63 | }, | ||
64 | set: function(newVal) { | ||
65 | if(this._currentSelectedContainer !== newVal) { | ||
66 | this._currentSelectedContainer = newVal; | ||
67 | if (this._ignoreNextContainerChange === true) { | ||
68 | this._ignoreNextContainerChange = false; | ||
69 | return; | ||
70 | } | ||
71 | this.application.ninja.currentDocument.setLevel = true; | ||
72 | |||
73 | if(this._currentDocument.currentView === "design") { | ||
74 | this._boolCacheArrays = false; | ||
75 | this.clearTimelinePanel(); | ||
76 | this._boolCacheArrays = true; | ||
77 | |||
78 | // Rebind the document events for the new document context | ||
79 | this._bindDocumentEvents(); | ||
80 | |||
81 | // Initialize the timeline for the document. | ||
82 | this.initTimelineForDocument(); | ||
83 | } | ||
49 | } | 84 | } |
50 | } | 85 | } |
51 | }, | 86 | }, |
@@ -171,27 +206,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
171 | this._lastLayerClicked = newVal | 206 | this._lastLayerClicked = newVal |
172 | } | 207 | } |
173 | }, | 208 | }, |
174 | |||
175 | _currentSelectedContainer: { | ||
176 | value: null | ||
177 | }, | ||
178 | currentSelectedContainer: { | ||
179 | get: function() { | ||
180 | return this._currentSelectedContainer; | ||
181 | }, | ||
182 | set: function(newVal) { | ||
183 | if(this._currentSelectedContainer !== newVal) { | ||
184 | this._currentSelectedContainer = newVal; | ||
185 | |||
186 | this._boolCacheArrays = false; | ||
187 | this.clearTimelinePanel(); | ||
188 | this._boolCacheArrays = true; | ||
189 | |||
190 | // TODO: Fix the function so that we can remove this call here. | ||
191 | this.initTimelineForDocument(); | ||
192 | } | ||
193 | } | ||
194 | }, | ||
195 | 209 | ||
196 | _millisecondsOffset:{ | 210 | _millisecondsOffset:{ |
197 | value:1000 | 211 | value:1000 |
@@ -448,6 +462,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
448 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | 462 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); |
449 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | 463 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); |
450 | 464 | ||
465 | |||
466 | // Bind some bindings | ||
467 | Object.defineBinding(this, "currentSelectedContainer", { | ||
468 | boundObject:this.application.ninja, | ||
469 | boundObjectPropertyPath:"currentSelectedContainer", | ||
470 | oneway:true | ||
471 | }); | ||
472 | |||
451 | } | 473 | } |
452 | }, | 474 | }, |
453 | 475 | ||
@@ -715,19 +737,19 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
715 | 737 | ||
716 | // Initialize the timeline for a document. | 738 | // Initialize the timeline for a document. |
717 | // Called when a document is opened (new or existing), or when documents are switched. | 739 | // Called when a document is opened (new or existing), or when documents are switched. |
740 | _ignoreNextContainerChange: { | ||
741 | value: true | ||
742 | }, | ||
718 | initTimelineForDocument:{ | 743 | initTimelineForDocument:{ |
719 | value:function () { | 744 | value:function () { |
720 | 745 | var myIndex; | |
721 | |||
722 | var myIndex, | ||
723 | boolAlreadyInitialized = false; | ||
724 | this.drawTimeMarkers(); | 746 | this.drawTimeMarkers(); |
725 | // Document switching | 747 | // Document switching |
726 | // Check to see if we have saved timeline information in the currentDocument. | 748 | // Check to see if we have saved timeline information in the currentDocument. |
727 | //console.log("TimelinePanel.initTimelineForDocument"); | 749 | //console.log("TimelinePanel.initTimelineForDocument"); |
728 | 750 | ||
729 | if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { | 751 | if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { |
730 | //console.log('TimelinePanel.initTimelineForDocument: new Document'); | 752 | // console.log('TimelinePanel.initTimelineForDocument: new Document'); |
731 | // No, we have no information stored. | 753 | // No, we have no information stored. |
732 | // This could mean we are creating a new file, OR are opening an existing file. | 754 | // This could mean we are creating a new file, OR are opening an existing file. |
733 | 755 | ||
@@ -751,11 +773,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
751 | // Draw the repetition. | 773 | // Draw the repetition. |
752 | this.arrLayers = this.temparrLayers; | 774 | this.arrLayers = this.temparrLayers; |
753 | this.currentLayerNumber = this.arrLayers.length; | 775 | this.currentLayerNumber = this.arrLayers.length; |
776 | this._ignoreNextContainerChange = true; | ||
754 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; | 777 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; |
755 | boolAlreadyInitialized = true; | ||
756 | 778 | ||
757 | } else if (this.application.ninja.currentDocument.setLevel) { | 779 | } else if (this.application.ninja.currentDocument.setLevel) { |
758 | //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); | 780 | // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); |
759 | // Information stored, but we're moving up or down in the breadcrumb. | 781 | // Information stored, but we're moving up or down in the breadcrumb. |
760 | // Get the current selection and restore timeline info for its children. | 782 | // Get the current selection and restore timeline info for its children. |
761 | //debugger; | 783 | //debugger; |
@@ -771,10 +793,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
771 | // Draw the repetition. | 793 | // Draw the repetition. |
772 | this.arrLayers = this.temparrLayers; | 794 | this.arrLayers = this.temparrLayers; |
773 | this.currentLayerNumber = storedCurrentLayerNumber; | 795 | this.currentLayerNumber = storedCurrentLayerNumber; |
774 | boolAlreadyInitialized = true; | ||
775 | this.application.ninja.currentDocument.setLevel = false; | 796 | this.application.ninja.currentDocument.setLevel = false; |
797 | |||
776 | } else { | 798 | } else { |
777 | //console.log('TimelinePanel.initTimelineForDocument: else fallback'); | 799 | // console.log('TimelinePanel.initTimelineForDocument: else fallback'); |
778 | // we do have information stored. Use it. | 800 | // we do have information stored. Use it. |
779 | var i = 0, | 801 | var i = 0, |
780 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; | 802 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; |