diff options
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 90 | ||||
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 4 |
2 files changed, 61 insertions, 33 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index bb5ca036..871a723b 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 | }, |
@@ -145,8 +180,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
145 | return this._currentSelectedContainer; | 180 | return this._currentSelectedContainer; |
146 | }, | 181 | }, |
147 | set: function(newVal) { | 182 | set: function(newVal) { |
148 | this._currentSelectedContainer = newVal; | 183 | if(this._currentSelectedContainer !== newVal) { |
149 | this.handleDocumentChange(); | 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 | } | ||
150 | } | 193 | } |
151 | }, | 194 | }, |
152 | 195 | ||
@@ -391,6 +434,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
391 | prepareForDraw:{ | 434 | prepareForDraw:{ |
392 | value:function () { | 435 | value:function () { |
393 | this.initTimeline(); | 436 | this.initTimeline(); |
437 | |||
438 | // Bind drag and drop event handlers | ||
439 | this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); | ||
440 | this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); | ||
441 | this.container_layers.addEventListener("dragover", this.handleLayerDragover.bind(this), false); | ||
442 | this.container_layers.addEventListener("drop", this.handleLayerDrop.bind(this), false); | ||
443 | |||
444 | // Bind the handlers for the config menu | ||
445 | this.checkable_animated.addEventListener("click", this.handleAnimatedClick.bind(this), false); | ||
446 | this.checkable_relative.addEventListener("click", this.handleRelativeClick.bind(this), false); | ||
447 | this.checkable_absolute.addEventListener("click", this.handleAbsoluteClick.bind(this), false); | ||
448 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | ||
449 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | ||
450 | |||
394 | } | 451 | } |
395 | }, | 452 | }, |
396 | 453 | ||
@@ -792,36 +849,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
792 | 849 | ||
793 | handleDocumentChange:{ | 850 | handleDocumentChange:{ |
794 | value:function () { | 851 | value:function () { |
795 | // console.log("TimelinePanel.handleDocumentChange"); | ||
796 | |||
797 | if (this.application.ninja.currentDocument == null) { | ||
798 | // On app initialization, the binding is triggered before | ||
799 | // there is a currentDocument. We don't do anything at that time. | ||
800 | return; | ||
801 | } | ||
802 | |||
803 | // Is this the same document? | ||
804 | if (this._currentDocumentUuid === this.application.ninja.currentDocument.uuid) { | ||
805 | // Yes, same document, so we are changing levels. | ||
806 | this.application.ninja.currentDocument.setLevel = true; | ||
807 | this._ignoreSelectionChanges = true; | ||
808 | } | ||
809 | |||
810 | this._boolCacheArrays = false; | ||
811 | this.clearTimelinePanel(); | ||
812 | this._boolCacheArrays = true; | ||
813 | |||
814 | // Rebind the document events for the new document context | ||
815 | this._bindDocumentEvents(); | ||
816 | 852 | ||
817 | // Reinitialize the timeline...but only if there are open documents. | ||
818 | if (this.application.ninja.documentController._documents.length > 0) { | ||
819 | this.enablePanel(true); | ||
820 | this.initTimelineForDocument(); | ||
821 | |||
822 | } else { | ||
823 | this.enablePanel(false); | ||
824 | } | ||
825 | } | 853 | } |
826 | }, | 854 | }, |
827 | 855 | ||
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 6b66bda9..ae6ff114 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -684,7 +684,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
684 | this.nextKeyframe += 1; | 684 | this.nextKeyframe += 1; |
685 | } | 685 | } |
686 | 686 | ||
687 | this.application.ninja.documentController.activeDocument.model.needsSave = true; | 687 | this.application.ninja.currentDocument.model.needsSave = true; |
688 | } | 688 | } |
689 | }, | 689 | }, |
690 | 690 | ||
@@ -884,7 +884,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
884 | keyframeString += " }"; | 884 | keyframeString += " }"; |
885 | // set the keyframe string as the new rule | 885 | // set the keyframe string as the new rule |
886 | this.currentKeyframeRule = this.ninjaStylesContoller.addRule(keyframeString); | 886 | this.currentKeyframeRule = this.ninjaStylesContoller.addRule(keyframeString); |
887 | this.application.ninja.documentController.activeDocument.model.needsSave = true; | 887 | this.application.ninja.currentDocument.model.needsSave = true; |
888 | } | 888 | } |
889 | }, | 889 | }, |
890 | 890 | ||