aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-06 00:27:59 -0700
committerValerio Virgillito2012-06-06 00:27:59 -0700
commit91123fef348ec54d89005adbc151e816856a6a18 (patch)
treeac20e473f2ef52ef1f7deb18eab4d38d6a35ec4b /js/panels/Timeline
parent0e1a276f19ea70009c5a649e9667861d7c346a7e (diff)
parent18e212dca48066d1ddaca96875a3f40adcc859b6 (diff)
downloadninja-91123fef348ec54d89005adbc151e816856a6a18.tar.gz
Merge branch 'refs/heads/master' into montage-v10-integration
Conflicts: js/components/tools-properties/fill-properties.reel/fill-properties.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js96
1 files changed, 56 insertions, 40 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 7af88662..22991a82 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -112,6 +112,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
112 return this._currentDocument; 112 return this._currentDocument;
113 }, 113 },
114 set : function(value) { 114 set : function(value) {
115 // If it's the same document, do nothing.
115 if (value === this._currentDocument) { 116 if (value === this._currentDocument) {
116 return; 117 return;
117 } 118 }
@@ -123,6 +124,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
123 this._currentDocument = value; 124 this._currentDocument = value;
124 125
125 if(!value) { 126 if(!value) {
127 this._boolCacheArrays = false;
128 this.clearTimelinePanel();
129 this._boolCacheArrays = true;
126 this.enablePanel(false); 130 this.enablePanel(false);
127 } else if(this._currentDocument.currentView === "design") { 131 } else if(this._currentDocument.currentView === "design") {
128 this._boolCacheArrays = false; 132 this._boolCacheArrays = false;
@@ -131,9 +135,40 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
131 135
132 // Rebind the document events for the new document context 136 // Rebind the document events for the new document context
133 this._bindDocumentEvents(); 137 this._bindDocumentEvents();
134 138
135 // TODO: Fix the init function so that it can be called here instead of when container changes 139 // Initialize the timeline for the document.
136 // this.initTimelineForDocument(); 140 this.initTimelineForDocument();
141 }
142 }
143 },
144
145 _currentSelectedContainer: {
146 value: null
147 },
148 currentSelectedContainer: {
149 get: function() {
150 return this._currentSelectedContainer;
151 },
152 set: function(newVal) {
153 if(this._currentSelectedContainer !== newVal) {
154 this._currentSelectedContainer = newVal;
155 if (this._ignoreNextContainerChange === true) {
156 this._ignoreNextContainerChange = false;
157 return;
158 }
159 this.application.ninja.currentDocument.setLevel = true;
160
161 if(this._currentDocument.currentView === "design") {
162 this._boolCacheArrays = false;
163 this.clearTimelinePanel();
164 this._boolCacheArrays = true;
165
166 // Rebind the document events for the new document context
167 this._bindDocumentEvents();
168
169 // Initialize the timeline for the document.
170 this.initTimelineForDocument();
171 }
137 } 172 }
138 } 173 }
139 }, 174 },
@@ -259,27 +294,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
259 this.cacheTimeline(); 294 this.cacheTimeline();
260 } 295 }
261 }, 296 },
262
263 _currentSelectedContainer: {
264 value: null
265 },
266 currentSelectedContainer: {
267 get: function() {
268 return this._currentSelectedContainer;
269 },
270 set: function(newVal) {
271 if(this._currentSelectedContainer !== newVal) {
272 this._currentSelectedContainer = newVal;
273 297
274 this._boolCacheArrays = false;
275 this.clearTimelinePanel();
276 this._boolCacheArrays = true;
277
278 // TODO: Fix the function so that we can remove this call here.
279 this.initTimelineForDocument();
280 }
281 }
282 },
283 298
284 _millisecondsOffset:{ 299 _millisecondsOffset:{
285 value:1000 300 value:1000
@@ -480,6 +495,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
480 this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); 495 this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false);
481 document.addEventListener("click", this.handleDocumentClick.bind(this), false); 496 document.addEventListener("click", this.handleDocumentClick.bind(this), false);
482 497
498
499 // Bind some bindings
500 Object.defineBinding(this, "currentSelectedContainer", {
501 boundObject:this.application.ninja,
502 boundObjectPropertyPath:"currentSelectedContainer",
503 oneway:true
504 });
505
483 } 506 }
484 }, 507 },
485 508
@@ -688,14 +711,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
688 this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); 711 this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false);
689 this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); 712 this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false);
690 this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); 713 this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false);
691 714
692 // Bind some bindings
693 Object.defineBinding(this, "currentSelectedContainer", {
694 boundObject:this.application.ninja,
695 boundObjectPropertyPath:"currentSelectedContainer",
696 oneway:true
697 });
698
699 // Start the panel out in disabled mode by default 715 // Start the panel out in disabled mode by default
700 // (Will be switched on later, if appropriate). 716 // (Will be switched on later, if appropriate).
701 this.enablePanel(false); 717 this.enablePanel(false);
@@ -705,17 +721,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
705 721
706 // Initialize the timeline for a document. 722 // Initialize the timeline for a document.
707 // Called when a document is opened (new or existing), or when documents are switched. 723 // Called when a document is opened (new or existing), or when documents are switched.
724 _ignoreNextContainerChange: {
725 value: true
726 },
708 initTimelineForDocument:{ 727 initTimelineForDocument:{
709 value:function () { 728 value:function () {
710 729 var myIndex;
711
712 var myIndex,
713 boolAlreadyInitialized = false;
714 this.drawTimeMarkers(); 730 this.drawTimeMarkers();
715 // Document switching 731 // Document switching
716 // Check to see if we have saved timeline information in the currentDocument. 732 // Check to see if we have saved timeline information in the currentDocument.
717 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { 733 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) {
718 //console.log('TimelinePanel.initTimelineForDocument: new Document'); 734 // console.log('TimelinePanel.initTimelineForDocument: new Document');
719 // No, we have no information stored. 735 // No, we have no information stored.
720 // This could mean we are creating a new file, OR are opening an existing file. 736 // This could mean we are creating a new file, OR are opening an existing file.
721 737
@@ -739,10 +755,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
739 // Draw the repetition. 755 // Draw the repetition.
740 this.arrLayers = this.temparrLayers; 756 this.arrLayers = this.temparrLayers;
741 this.currentLayerNumber = this.arrLayers.length; 757 this.currentLayerNumber = this.arrLayers.length;
742 boolAlreadyInitialized = true; 758 this._ignoreNextContainerChange = true;
743 759
744 } else if (this.application.ninja.currentDocument.setLevel) { 760 } else if (this.application.ninja.currentDocument.setLevel) {
745 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); 761 // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick');
746 // Information stored, but we're moving up or down in the breadcrumb. 762 // Information stored, but we're moving up or down in the breadcrumb.
747 // Get the current selection and restore timeline info for its children. 763 // Get the current selection and restore timeline info for its children.
748 var parentNode = this.application.ninja.currentSelectedContainer, 764 var parentNode = this.application.ninja.currentSelectedContainer,
@@ -757,12 +773,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
757 // Draw the repetition. 773 // Draw the repetition.
758 this.arrLayers = this.temparrLayers; 774 this.arrLayers = this.temparrLayers;
759 this.currentLayerNumber = storedCurrentLayerNumber; 775 this.currentLayerNumber = storedCurrentLayerNumber;
760 boolAlreadyInitialized = true;
761 this.application.ninja.currentDocument.setLevel = false; 776 this.application.ninja.currentDocument.setLevel = false;
762 777
763 778
779
764 } else { 780 } else {
765 //console.log('TimelinePanel.initTimelineForDocument: else fallback'); 781 // console.log('TimelinePanel.initTimelineForDocument: else fallback');
766 // we do have information stored. Use it. 782 // we do have information stored. Use it.
767 var i = 0, 783 var i = 0,
768