diff options
author | hwc487 | 2012-06-05 14:05:34 -0700 |
---|---|---|
committer | hwc487 | 2012-06-05 14:05:34 -0700 |
commit | 920436977433ea55c01ce1e73895d1db0a6abac1 (patch) | |
tree | 8dcf9fb4bd1c23d121e9e2166325f8fdd1dc9884 /js/panels/Timeline | |
parent | 641d59527d842b5adc626a38677365cb9d943840 (diff) | |
parent | fae2c19f64a00098fe42da5e9c6cb7cdcc8c8721 (diff) | |
download | ninja-920436977433ea55c01ce1e73895d1db0a6abac1.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/TimelinePanel.reel/TimelinePanel.js | 96 |
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 6e9513f2..d7329ac7 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 | }, |
@@ -170,27 +205,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
170 | this.cacheTimeline(); | 205 | this.cacheTimeline(); |
171 | } | 206 | } |
172 | }, | 207 | }, |
173 | |||
174 | _currentSelectedContainer: { | ||
175 | value: null | ||
176 | }, | ||
177 | currentSelectedContainer: { | ||
178 | get: function() { | ||
179 | return this._currentSelectedContainer; | ||
180 | }, | ||
181 | set: function(newVal) { | ||
182 | if(this._currentSelectedContainer !== newVal) { | ||
183 | this._currentSelectedContainer = newVal; | ||
184 | 208 | ||
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 | } | ||
192 | } | ||
193 | }, | ||
194 | 209 | ||
195 | _millisecondsOffset:{ | 210 | _millisecondsOffset:{ |
196 | value:1000 | 211 | value:1000 |
@@ -390,6 +405,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
390 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | 405 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); |
391 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | 406 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); |
392 | 407 | ||
408 | |||
409 | // Bind some bindings | ||
410 | Object.defineBinding(this, "currentSelectedContainer", { | ||
411 | boundObject:this.application.ninja, | ||
412 | boundObjectPropertyPath:"currentSelectedContainer", | ||
413 | oneway:true | ||
414 | }); | ||
415 | |||
393 | } | 416 | } |
394 | }, | 417 | }, |
395 | 418 | ||
@@ -596,14 +619,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
596 | this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); | 619 | this.playhead.addEventListener("mousedown", this.startPlayheadTracking.bind(this), false); |
597 | this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); | 620 | this.playhead.addEventListener("mouseup", this.stopPlayheadTracking.bind(this), false); |
598 | this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); | 621 | this.time_markers.addEventListener("click", this.updatePlayhead.bind(this), false); |
599 | 622 | ||
600 | // Bind some bindings | ||
601 | Object.defineBinding(this, "currentSelectedContainer", { | ||
602 | boundObject:this.application.ninja, | ||
603 | boundObjectPropertyPath:"currentSelectedContainer", | ||
604 | oneway:true | ||
605 | }); | ||
606 | |||
607 | // Start the panel out in disabled mode by default | 623 | // Start the panel out in disabled mode by default |
608 | // (Will be switched on later, if appropriate). | 624 | // (Will be switched on later, if appropriate). |
609 | this.enablePanel(false); | 625 | this.enablePanel(false); |
@@ -613,17 +629,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
613 | 629 | ||
614 | // Initialize the timeline for a document. | 630 | // Initialize the timeline for a document. |
615 | // Called when a document is opened (new or existing), or when documents are switched. | 631 | // Called when a document is opened (new or existing), or when documents are switched. |
632 | _ignoreNextContainerChange: { | ||
633 | value: true | ||
634 | }, | ||
616 | initTimelineForDocument:{ | 635 | initTimelineForDocument:{ |
617 | value:function () { | 636 | value:function () { |
618 | 637 | var myIndex; | |
619 | |||
620 | var myIndex, | ||
621 | boolAlreadyInitialized = false; | ||
622 | this.drawTimeMarkers(); | 638 | this.drawTimeMarkers(); |
623 | // Document switching | 639 | // Document switching |
624 | // Check to see if we have saved timeline information in the currentDocument. | 640 | // Check to see if we have saved timeline information in the currentDocument. |
625 | if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { | 641 | if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { |
626 | //console.log('TimelinePanel.initTimelineForDocument: new Document'); | 642 | // console.log('TimelinePanel.initTimelineForDocument: new Document'); |
627 | // No, we have no information stored. | 643 | // No, we have no information stored. |
628 | // This could mean we are creating a new file, OR are opening an existing file. | 644 | // This could mean we are creating a new file, OR are opening an existing file. |
629 | 645 | ||
@@ -647,10 +663,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
647 | // Draw the repetition. | 663 | // Draw the repetition. |
648 | this.arrLayers = this.temparrLayers; | 664 | this.arrLayers = this.temparrLayers; |
649 | this.currentLayerNumber = this.arrLayers.length; | 665 | this.currentLayerNumber = this.arrLayers.length; |
650 | boolAlreadyInitialized = true; | 666 | this._ignoreNextContainerChange = true; |
651 | 667 | ||
652 | } else if (this.application.ninja.currentDocument.setLevel) { | 668 | } else if (this.application.ninja.currentDocument.setLevel) { |
653 | //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); | 669 | // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); |
654 | // Information stored, but we're moving up or down in the breadcrumb. | 670 | // Information stored, but we're moving up or down in the breadcrumb. |
655 | // Get the current selection and restore timeline info for its children. | 671 | // Get the current selection and restore timeline info for its children. |
656 | var parentNode = this.application.ninja.currentSelectedContainer, | 672 | var parentNode = this.application.ninja.currentSelectedContainer, |
@@ -665,12 +681,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
665 | // Draw the repetition. | 681 | // Draw the repetition. |
666 | this.arrLayers = this.temparrLayers; | 682 | this.arrLayers = this.temparrLayers; |
667 | this.currentLayerNumber = storedCurrentLayerNumber; | 683 | this.currentLayerNumber = storedCurrentLayerNumber; |
668 | boolAlreadyInitialized = true; | ||
669 | this.application.ninja.currentDocument.setLevel = false; | 684 | this.application.ninja.currentDocument.setLevel = false; |
670 | 685 | ||
671 | 686 | ||
687 | |||
672 | } else { | 688 | } else { |
673 | //console.log('TimelinePanel.initTimelineForDocument: else fallback'); | 689 | // console.log('TimelinePanel.initTimelineForDocument: else fallback'); |
674 | // we do have information stored. Use it. | 690 | // we do have information stored. Use it. |
675 | var i = 0, | 691 | var i = 0, |
676 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; | 692 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayer |