diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 131 |
1 files changed, 119 insertions, 12 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 509ec7b1..734b051f 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -11,10 +11,98 @@ var Montage = require("montage/core/core").Montage, | |||
11 | 11 | ||
12 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | 12 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { |
13 | 13 | ||
14 | hasTemplate:{ | 14 | user_layers: { |
15 | value:true | 15 | value: null, |
16 | serializable: true | ||
17 | }, | ||
18 | |||
19 | track_container: { | ||
20 | value: null, | ||
21 | serializable: true | ||
22 | }, | ||
23 | |||
24 | timeline_leftpane: { | ||
25 | value: null, | ||
26 | serializable: true | ||
27 | }, | ||
28 | |||
29 | layer_tracks: { | ||
30 | value: null, | ||
31 | serializable: true | ||
32 | }, | ||
33 | |||
34 | master_track: { | ||
35 | value: null, | ||
36 | serializable: true | ||
37 | }, | ||
38 | |||
39 | time_markers: { | ||
40 | value: null, | ||
41 | serializable: true | ||
42 | }, | ||
43 | |||
44 | playhead: { | ||
45 | value: null, | ||
46 | serializable: true | ||
47 | }, | ||
48 | |||
49 | playheadmarker: { | ||
50 | value: null, | ||
51 | serializable: true | ||
52 | }, | ||
53 | |||
54 | timetext: { | ||
55 | value: null, | ||
56 | serializable: true | ||
57 | }, | ||
58 | |||
59 | timebar: { | ||
60 | value: null, | ||
61 | serializable: true | ||
62 | }, | ||
63 | |||
64 | container_tracks: { | ||
65 | value: null, | ||
66 | serializable: true | ||
67 | }, | ||
68 | |||
69 | end_hottext: { | ||
70 | value: null, | ||
71 | serializable: true | ||
72 | }, | ||
73 | |||
74 | container_layers: { | ||
75 | value: null, | ||
76 | serializable: true | ||
77 | }, | ||
78 | |||
79 | timeline_disabler: { | ||
80 | value: null, | ||
81 | serializable: true | ||
82 | }, | ||
83 | |||
84 | checkable_relative: { | ||
85 | value: null, | ||
86 | serializable: true | ||
87 | }, | ||
88 | |||
89 | checkable_absolute: { | ||
90 | value: null, | ||
91 | serializable: true | ||
92 | }, | ||
93 | |||
94 | checkable_animated: { | ||
95 | value: null, | ||
96 | serializable: true | ||
16 | }, | 97 | }, |
17 | 98 | ||
99 | tl_configbutton: { | ||
100 | value: null, | ||
101 | serializable: true | ||
102 | }, | ||
103 | |||
104 | |||
105 | |||
18 | /* === BEGIN: Models === */ | 106 | /* === BEGIN: Models === */ |
19 | _currentDocument: { | 107 | _currentDocument: { |
20 | value : null | 108 | value : null |
@@ -54,6 +142,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
54 | } | 142 | } |
55 | } | 143 | } |
56 | }, | 144 | }, |
145 | |||
146 | handleChange: { | ||
147 | value: function() { | ||
148 | if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) { | ||
149 | this.currentSelectedContainer = this.currentDocument.model.getProperty("domContainer"); | ||
150 | } | ||
151 | } | ||
152 | }, | ||
57 | 153 | ||
58 | _currentSelectedContainer: { | 154 | _currentSelectedContainer: { |
59 | value: null | 155 | value: null |
@@ -486,6 +582,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
486 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | 582 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); |
487 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | 583 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); |
488 | 584 | ||
585 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); | ||
489 | 586 | ||
490 | // Bind some bindings | 587 | // Bind some bindings |
491 | Object.defineBinding(this, "currentSelectedContainer", { | 588 | Object.defineBinding(this, "currentSelectedContainer", { |
@@ -608,11 +705,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
608 | // Store the timeline data in currentDocument... | 705 | // Store the timeline data in currentDocument... |
609 | if (this._boolCacheArrays) { | 706 | if (this._boolCacheArrays) { |
610 | // ... but only if we're supposed to. | 707 | // ... but only if we're supposed to. |
611 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 708 | if(this.currentDocument) { |
612 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; | 709 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
613 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 710 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; |
614 | this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; | 711 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
615 | this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; | 712 | this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; |
713 | this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; | ||
714 | } | ||
616 | this.application.ninja.currentDocument.tlCurrentElementsSelected = this.currentElementsSelected; | 715 | this.application.ninja.currentDocument.tlCurrentElementsSelected = this.currentElementsSelected; |
617 | } | 716 | } |
618 | } | 717 | } |
@@ -623,7 +722,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
623 | // Initialize the currentDocument for a new set of timeline data. | 722 | // Initialize the currentDocument for a new set of timeline data. |
624 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 723 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
625 | this.application.ninja.currentDocument.tlArrLayers = []; | 724 | this.application.ninja.currentDocument.tlArrLayers = []; |
626 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; | 725 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; |
627 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 726 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
628 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; | 727 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; |
629 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; | 728 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; |
@@ -806,8 +905,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
806 | // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); | 905 | // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); |
807 | // Information stored, but we're moving up or down in the breadcrumb. | 906 | // Information stored, but we're moving up or down in the breadcrumb. |
808 | // Get the current selection and restore timeline info for its children. | 907 | // Get the current selection and restore timeline info for its children. |
809 | //debugger; | 908 | var parentNode = this.currentDocument.model.domContainer, |
810 | var parentNode = this.application.ninja.currentSelectedContainer, | ||
811 | storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 909 | storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
812 | this.temparrLayers = []; | 910 | this.temparrLayers = []; |
813 | 911 | ||
@@ -827,6 +925,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
827 | var i = 0, | 925 | var i = 0, |
828 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; | 926 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; |
829 | 927 | ||
928 | |||
929 | this._ignoreNextContainerChange = true; | ||
930 | |||
830 | // We're reading from the cache, not writing to it. | 931 | // We're reading from the cache, not writing to it. |
831 | this._boolCacheArrays = false; | 932 | this._boolCacheArrays = false; |
832 | for (i = 0; i < tlArrLayersLength; i++) { | 933 | for (i = 0; i < tlArrLayersLength; i++) { |
@@ -840,6 +941,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
840 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 941 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
841 | this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; | 942 | this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; |
842 | this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; | 943 | this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; |
944 | |||
945 | |||
946 | //debugger; | ||
947 | if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") { | ||
948 | // this.currentDocument.model.domContainer = this.application.ninja.currentDocument.tlCurrentSelectedContainer; | ||
949 | } | ||
843 | this.currentElementsSelected = this.application.ninja.currentDocument.tlCurrentElementsSelected; | 950 | this.currentElementsSelected = this.application.ninja.currentDocument.tlCurrentElementsSelected; |
844 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; | 951 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; |
845 | 952 | ||
@@ -1276,7 +1383,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1276 | thingToPush.layerData.layerName = stageElementName; | 1383 | thingToPush.layerData.layerName = stageElementName; |
1277 | thingToPush.layerData.layerTag = "<" + object.nodeName.toLowerCase() + ">"; |