diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 133 |
1 files changed, 114 insertions, 19 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index d7329ac7..cb8185e5 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -10,10 +10,98 @@ var nj = require("js/lib/NJUtils").NJUtils; | |||
10 | 10 | ||
11 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | 11 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { |
12 | 12 | ||
13 | hasTemplate:{ | 13 | user_layers: { |
14 | value:true | 14 | value: null, |
15 | serializable: true | ||
16 | }, | ||
17 | |||
18 | track_container: { | ||
19 | value: null, | ||
20 | serializable: true | ||
21 | }, | ||
22 | |||
23 | timeline_leftpane: { | ||
24 | value: null, | ||
25 | serializable: true | ||
26 | }, | ||
27 | |||
28 | layer_tracks: { | ||
29 | value: null, | ||
30 | serializable: true | ||
31 | }, | ||
32 | |||
33 | master_track: { | ||
34 | value: null, | ||
35 | serializable: true | ||
36 | }, | ||
37 | |||
38 | time_markers: { | ||
39 | value: null, | ||
40 | serializable: true | ||
41 | }, | ||
42 | |||
43 | playhead: { | ||
44 | value: null, | ||
45 | serializable: true | ||
46 | }, | ||
47 | |||
48 | playheadmarker: { | ||
49 | value: null, | ||
50 | serializable: true | ||
51 | }, | ||
52 | |||
53 | timetext: { | ||
54 | value: null, | ||
55 | serializable: true | ||
56 | }, | ||
57 | |||
58 | timebar: { | ||
59 | value: null, | ||
60 | serializable: true | ||
61 | }, | ||
62 | |||
63 | container_tracks: { | ||
64 | value: null, | ||
65 | serializable: true | ||
15 | }, | 66 | }, |
16 | 67 | ||
68 | end_hottext: { | ||
69 | value: null, | ||
70 | serializable: true | ||
71 | }, | ||
72 | |||
73 | container_layers: { | ||
74 | value: null, | ||
75 | serializable: true | ||
76 | }, | ||
77 | |||
78 | timeline_disabler: { | ||
79 | value: null, | ||
80 | serializable: true | ||
81 | }, | ||
82 | |||
83 | checkable_relative: { | ||
84 | value: null, | ||
85 | serializable: true | ||
86 | }, | ||
87 | |||
88 | checkable_absolute: { | ||
89 | value: null, | ||
90 | serializable: true | ||
91 | }, | ||
92 | |||
93 | checkable_animated: { | ||
94 | value: null, | ||
95 | serializable: true | ||
96 | }, | ||
97 | |||
98 | tl_configbutton: { | ||
99 | value: null, | ||
100 | serializable: true | ||
101 | }, | ||
102 | |||
103 | |||
104 | |||
17 | /* === BEGIN: Models === */ | 105 | /* === BEGIN: Models === */ |
18 | _currentDocument: { | 106 | _currentDocument: { |
19 | value : null | 107 | value : null |
@@ -53,6 +141,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
53 | } | 141 | } |
54 | } | 142 | } |
55 | }, | 143 | }, |
144 | |||
145 | handleChange: { | ||
146 | value: function() { | ||
147 | if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) { | ||
148 | this.currentSelectedContainer = this.currentDocument.model.getProperty("domContainer"); | ||
149 | } | ||
150 | } | ||
151 | }, | ||
56 | 152 | ||
57 | _currentSelectedContainer: { | 153 | _currentSelectedContainer: { |
58 | value: null | 154 | value: null |
@@ -405,13 +501,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
405 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | 501 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); |
406 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | 502 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); |
407 | 503 | ||
408 | 504 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); | |
409 | // Bind some bindings | ||
410 | Object.defineBinding(this, "currentSelectedContainer", { | ||
411 | boundObject:this.application.ninja, | ||
412 | boundObjectPropertyPath:"currentSelectedContainer", | ||
413 | oneway:true | ||
414 | }); | ||
415 | 505 | ||
416 | } | 506 | } |
417 | }, | 507 | }, |
@@ -511,11 +601,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
511 | // Store the timeline data in currentDocument... | 601 | // Store the timeline data in currentDocument... |
512 | if (this._boolCacheArrays) { | 602 | if (this._boolCacheArrays) { |
513 | // ... but only if we're supposed to. | 603 | // ... but only if we're supposed to. |
514 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 604 | if(this.currentDocument) { |
515 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; | 605 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
516 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 606 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; |
517 | this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; | 607 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
518 | this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; | 608 | this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; |
609 | this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; | ||
610 | } | ||
519 | } | 611 | } |
520 | } | 612 | } |
521 | }, | 613 | }, |
@@ -525,7 +617,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
525 | // Initialize the currentDocument for a new set of timeline data. | 617 | // Initialize the currentDocument for a new set of timeline data. |
526 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 618 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
527 | this.application.ninja.currentDocument.tlArrLayers = []; | 619 | this.application.ninja.currentDocument.tlArrLayers = []; |
528 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; | 620 | this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; |
529 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 621 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
530 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; | 622 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; |
531 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; | 623 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; |
@@ -669,7 +761,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
669 | // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); | 761 | // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); |
670 | // Information stored, but we're moving up or down in the breadcrumb. | 762 | // Information stored, but we're moving up or down in the breadcrumb. |
671 | // Get the current selection and restore timeline info for its children. | 763 | // Get the current selection and restore timeline info for its children. |
672 | var parentNode = this.application.ninja.currentSelectedContainer, | 764 | var parentNode = this.currentDocument.model.domContainer, |
673 | storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 765 | storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
674 | this.temparrLayers = []; | 766 | this.temparrLayers = []; |
675 | 767 | ||
@@ -691,6 +783,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
691 | var i = 0, | 783 | var i = 0, |
692 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; | 784 | tlArrLayersLength = this.application.ninja.currentDocument.tlArrLayers.length; |
693 | 785 | ||
786 | |||
787 | this._ignoreNextContainerChange = true; | ||
788 | |||
694 | // We're reading from the cache, not writing to it. | 789 | // We're reading from the cache, not writing to it. |
695 | this._boolCacheArrays = false; | 790 | this._boolCacheArrays = false; |
696 | for (i = 0; i < tlArrLayersLength; i++) { | 791 | for (i = 0; i < tlArrLayersLength; i++) { |
@@ -708,7 +803,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
708 | 803 | ||
709 | //debugger; | 804 | //debugger; |
710 | if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") { | 805 | if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") { |
711 | // this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer; | 806 | // this.currentDocument.model.domContainer = this.application.ninja.currentDocument.tlCurrentSelectedContainer; |
712 | } | 807 | } |
713 | 808 | ||
714 | // Are we only showing animated layers? | 809 | // Are we only showing animated layers? |
@@ -984,7 +1079,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
984 | thingToPush.layerData.layerName = newLayerName; | 1079 | thingToPush.layerData.layerName = newLayerName; |
985 | thingToPush.layerData.layerTag = "<" + object.nodeName.to |