aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-30 14:51:25 -0700
committerValerio Virgillito2012-05-30 14:51:25 -0700
commit501221d0bbf776ce71bc7ae0f482c931f6651659 (patch)
tree7854eda9c6e23c15662f30d3c99ef1c03a49ce7e /js/panels
parentdb22840ca995d670cf61d718d379eb2d4aaa3d59 (diff)
downloadninja-501221d0bbf776ce71bc7ae0f482c931f6651659.tar.gz
fixing the timeline current document bindings
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js88
-rwxr-xr-xjs/panels/properties.reel/properties.js3
2 files changed, 47 insertions, 44 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index b1fc97e4..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,11 +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("closeDocument", this.handleDocumentChange.bind(this), false);
339 //this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false);
340 //this.eventManager.addEventListener("breadCrumbBinding",this,false);
341
342 // Bind drag and drop event handlers 380 // Bind drag and drop event handlers
343 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); 381 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false);
344 this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); 382 this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false);
@@ -710,44 +748,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
710 748
711 handleDocumentChange:{ 749 handleDocumentChange:{
712 value:function () { 750 value:function () {
713 if (this.application.ninja.currentDocument == null) {
714 // On app initialization, the binding is triggered before
715 // there is a currentDocument. We don't do anything at that time.
716 return;
717 }
718 // this.application.ninja.currentDocument.setLevel = true;
719 this._boolCacheArrays = false;
720 this.clearTimelinePanel();
721 this._boolCacheArrays = true;
722
723 // Rebind the document events for the new document context
724 this._bindDocumentEvents();
725
726 // Reinitialize the timeline...but only if there are open documents.
727 if (this.application.ninja.documentController._documents.length > 0) {
728 this.enablePanel(true);
729 this.initTimelineForDocument();
730
731 } else {
732 this.enablePanel(false);
733 }
734 }
735 },
736
737 LayerBinding:{
738 value:function (node) {
739 var i = 0;
740 751
741 if(this._firstTimeLoaded){
742 this._firstTimeLoaded = false;
743 return;
744 }
745
746 this.handleDocumentChange(node);
747 } 752 }
748 }, 753 },
749 754
750
751 updateTrackContainerWidth:{ 755 updateTrackContainerWidth:{
752 value:function () { 756 value:function () {
753 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/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index 4b663220..d05fb058 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -14,8 +14,7 @@ var ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
14exports.Properties = Montage.create(Component, { 14exports.Properties = Montage.create(Component, {
15 15
16 _currentDocument: { 16 _currentDocument: {
17 value : null, 17 value : null
18 enumerable : false
19 }, 18 },
20 19
21 currentDocument : { 20 currentDocument : {