aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
authorhwc4872012-06-04 10:21:24 -0700
committerhwc4872012-06-04 10:21:24 -0700
commit468b20e7fbc27882f8a37c83afd86d1d06c52afd (patch)
tree6c2a9c26429c4852961bdabba8f3dad45499be85 /js/panels/Timeline
parent3f5351c5d75080727953caf5d8d9a312c1c9391b (diff)
parentc1ec69879028220b0c3f11ad6e24035bf527802c (diff)
downloadninja-468b20e7fbc27882f8a37c83afd86d1d06c52afd.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js4
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js89
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js4
3 files changed, 50 insertions, 47 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index e8619d02..16fb0303 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -717,7 +717,7 @@ var Layer = exports.Layer = Montage.create(Component, {
717 this.dynamicLayerName.value = this._layerEditable.value; 717 this.dynamicLayerName.value = this._layerEditable.value;
718 this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0].dataset.storedLayerName = this.dynamicLayerName.value; 718 this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0].dataset.storedLayerName = this.dynamicLayerName.value;
719 this.needsDraw = true; 719 this.needsDraw = true;
720 this.application.ninja.documentController.activeDocument.model.needsSave = true; 720 this.application.ninja.currentDocument.model.needsSave = true;
721 } 721 }
722 }, 722 },
723 handleAddStyleClick: { 723 handleAddStyleClick: {
@@ -745,7 +745,7 @@ var Layer = exports.Layer = Montage.create(Component, {
745 this.dynamicLayerName.value = newVal; 745 this.dynamicLayerName.value = newVal;
746 this.layerName = newVal; 746 this.layerName = newVal;
747 this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0].dataset.storedLayerName = newVal; 747 this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0].dataset.storedLayerName = newVal;
748 this.application.ninja.documentController.activeDocument.model.needsSave = true; 748 this.application.ninja.currentDocument.model.needsSave = true;
749 this.needsDraw = true; 749 this.needsDraw = true;
750 } 750 }
751 }, 751 },
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index c55e5a24..6e9513f2 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -15,6 +15,41 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
15 }, 15 },
16 16
17 /* === BEGIN: Models === */ 17 /* === BEGIN: Models === */
18 _currentDocument: {
19 value : null
20 },
21
22 currentDocument : {
23 get : function() {
24 return this._currentDocument;
25 },
26 set : function(value) {
27 if (value === this._currentDocument) {
28 return;
29 }
30
31 if(!this._currentDocument && value.currentView === "design") {
32 this.enablePanel(true);
33 }
34
35 this._currentDocument = value;
36
37 if(!value) {
38 this.enablePanel(false);
39 } else if(this._currentDocument.currentView === "design") {
40 this._boolCacheArrays = false;
41 this.clearTimelinePanel();
42 this._boolCacheArrays = true;
43
44 // Rebind the document events for the new document context
45 this._bindDocumentEvents();
46
47 // TODO: Fix the init function so that it can be called here instead of when container changes
48 // this.initTimelineForDocument();
49 }
50 }
51 },
52
18 _arrLayers:{ 53 _arrLayers:{
19 value:[] 54 value:[]
20 }, 55 },
@@ -144,8 +179,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
144 return this._currentSelectedContainer; 179 return this._currentSelectedContainer;
145 }, 180 },
146 set: function(newVal) { 181 set: function(newVal) {
147 this._currentSelectedContainer = newVal; 182 if(this._currentSelectedContainer !== newVal) {
148 this.handleDocumentChange(); 183 this._currentSelectedContainer = newVal;
184
185 this._boolCacheArrays = false;
186 this.clearTimelinePanel();
187 this._boolCacheArrays = true;
188
189 // TODO: Fix the function so that we can remove this call here.
190 this.initTimelineForDocument();
191 }
149 } 192 }
150 }, 193 },
151 194
@@ -233,7 +276,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
233 set:function (value) { 276 set:function (value) {
234 if (this._breadCrumbContainer !== value) { 277 if (this._breadCrumbContainer !== value) {
235 this._breadCrumbContainer = value; 278 this._breadCrumbContainer = value;
236 //this.LayerBinding();
237 } 279 }
238 } 280 }
239 }, 281 },
@@ -334,12 +376,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
334 prepareForDraw:{ 376 prepareForDraw:{
335 value:function () { 377 value:function () {
336 this.initTimeline(); 378 this.initTimeline();
337 // Bind the event handler for the document change events 379
338 //this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false);
339 this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false);
340 //this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false);
341 //this.eventManager.addEventListener("breadCrumbBinding",this,false);
342
343 // Bind drag and drop event handlers 380 // Bind drag and drop event handlers
344 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); 381 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false);
345 this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); 382 this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false);
@@ -711,44 +748,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
711 748
712 handleDocumentChange:{ 749 handleDocumentChange:{
713 value:function () { 750 value:function () {
714 if (this.application.ninja.currentDocument == null) {
715 // On app initialization, the binding is triggered before
716 // there is a currentDocument. We don't do anything at that time.
717 return;
718 }
719 // this.application.ninja.currentDocument.setLevel = true;
720 this._boolCacheArrays = false;
721 this.clearTimelinePanel();
722 this._boolCacheArrays = true;
723
724 // Rebind the document events for the new document context
725 this._bindDocumentEvents();
726
727 // Reinitialize the timeline...but only if there are open documents.
728 if (this.application.ninja.documentController._documents.length > 0) {
729 this.enablePanel(true);
730 this.initTimelineForDocument();
731
732 } else {
733 this.enablePanel(false);
734 }
735 }
736 },
737
738 LayerBinding:{
739 value:function (node) {
740 var i = 0;
741 751
742 if(this._firstTimeLoaded){
743 this._firstTimeLoaded = false;
744 return;
745 }
746
747 this.handleDocumentChange(node);
748 } 752 }
749 }, 753 },
750 754
751
752 updateTrackContainerWidth:{ 755 updateTrackContainerWidth:{
753 value:function () { 756 value:function () {
754 this.container_tracks.style.width = (this.end_hottext.value * 80) + "px"; 757 this.container_tracks.style.width = (this.end_hottext.value * 80) + "px";
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index ff684446..126e6a61 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -564,7 +564,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
564 this.nextKeyframe += 1; 564 this.nextKeyframe += 1;
565 } 565 }
566 566
567 this.application.ninja.documentController.activeDocument.model.needsSave = true; 567 this.application.ninja.currentDocument.model.needsSave = true;
568 } 568 }
569 }, 569 },
570 570
@@ -683,7 +683,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
683 keyframeString += " }"; 683 keyframeString += " }";
684 // set the keyframe string as the new rule 684 // set the keyframe string as the new rule
685 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(keyframeString); 685 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(keyframeString);
686 this.application.ninja.documentController.activeDocument.model.needsSave = true; 686 this.application.ninja.currentDocument.model.needsSave = true;
687 } 687 }
688 }, 688 },
689 689