aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js722
1 files changed, 393 insertions, 329 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 81415951..087bf3cd 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -28,7 +28,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
28 }, 28 },
29 set:function (newVal) { 29 set:function (newVal) {
30 this._arrLayers = newVal; 30 this._arrLayers = newVal;
31 this.application.ninja.currentDocument.tlArrLayers = newVal; 31 this._cacheArrays();
32 } 32 }
33 }, 33 },
34 34
@@ -45,6 +45,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
45 } 45 }
46 }, 46 },
47 47
48 _cacheArrays : {
49 value: function() {
50 if (this._boolCacheArrays) {
51 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
52
53 }
54 }
55 },
56
57 // Set to false to skip array caching array sets in current document
58 _boolCacheArrays : {
59 value: true
60 },
61
48 _currentLayerNumber:{ 62 _currentLayerNumber:{
49 value:0 63 value:0
50 }, 64 },
@@ -56,15 +70,44 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
56 set:function (newVal) { 70 set:function (newVal) {
57 if (newVal !== this._currentLayerNumber) { 71 if (newVal !== this._currentLayerNumber) {
58 this._currentLayerNumber = newVal; 72 this._currentLayerNumber = newVal;
73 this._setCurrentLayerNumber();
59 } 74 }
60 } 75 }
61 }, 76 },
62 77
63 currentLayerSelected:{ 78 _setCurrentLayerNumber:{
64 value: null 79 value:function(){
80 if (this._boolCacheArrays) {
81 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber;
82 }
83 }
84 },
85
86 _hashKey:{
87 value:0
88 },
89
90 hashKey:{
91 get:function () {
92 return this._hashKey;
93 },
94 set:function (newVal) {
95 if (newVal !== this._hashKey) {
96 this._hashKey = newVal;
97 this._setHashKey();
98 }
99 }
100 },
101
102 _setHashKey:{
103 value:function(){
104 if (this._boolCacheArrays) {
105 this.application.ninja.currentDocument.hashKey = this.hashKey;
106 }
107 }
65 }, 108 },
66 109
67 currentTrackSelected:{ 110 currentLayerSelected:{
68 value: null 111 value: null
69 }, 112 },
70 113
@@ -88,22 +131,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
88 } 131 }
89 }, 132 },
90 133
91 _arrTracks:{
92 serializable:true,
93 value:[]
94 },
95
96 arrTracks:{
97 serializable:true,
98 get:function () {
99 return this._arrTracks;
100 },
101 set:function (newVal) {
102 this._arrTracks = newVal;
103 this.application.ninja.currentDocument.tlArrTracks = newVal;
104 }
105 },
106
107 _trackRepetition:{ 134 _trackRepetition:{
108 serializable:true, 135 serializable:true,
109 value:null 136 value:null
@@ -147,6 +174,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
147 } 174 }
148 }, 175 },
149 176
177 _breadCrumbContainer:{
178 value:null
179 },
180
181 breadCrumbContainer: {
182 set: function(value) {
183 if(this._breadCrumbContainer !== value) {
184 this._breadCrumbContainer = value;
185 this.LayerBinding(this.application.ninja.currentSelectedContainer);
186 }
187 },
188 get: function() {
189 return this._breadCrumbContainer;
190 }
191 },
192
150 _isLayer:{ 193 _isLayer:{
151 value:false 194 value:false
152 }, 195 },
@@ -165,55 +208,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
165 value:false, 208 value:false,
166 writable:true 209 writable:true
167 }, 210 },
211
168 timeMarkerHolder:{ 212 timeMarkerHolder:{
169 value: null 213 value: null
170 }, 214 },
171 /* === END: Models === */ 215 /* === END: Models === */
172
173 /* === BEGIN: Draw cycle === */ 216 /* === BEGIN: Draw cycle === */
174 prepareForDraw:{ 217 prepareForDraw:{
175 value:function () { 218 value:function () {
176 this.initTimeline(); 219 this.initTimeline();
177 this.eventManager.addEventListener("onOpenDocument", this, false); 220 this.eventManager.addEventListener("onOpenDocument", this, false);
178 this.eventManager.addEventListener("closeDocument", this, false); 221 this.eventManager.addEventListener("closeDocument", this, false);
179 this.eventManager.addEventListener("switchDocument", this, false); 222 this.eventManager.addEventListener("switchDocument", this, false);
180 }
181 },
182
183 handleOnOpenDocument:{
184 value:function(){
185 this.clearTimelinePanel();
186 this.eventManager.addEventListener("deleteLayerClick", this, false);
187 this.eventManager.addEventListener("newLayer", this, false);
188 this.eventManager.addEventListener("deleteLayer", this, false);
189 this.eventManager.addEventListener("layerBinding", this, false);
190 this.eventManager.addEventListener("elementAdded", this, false);
191 this.eventManager.addEventListener("elementDeleted", this, false);
192 this.eventManager.addEventListener("deleteSelection", this, false);
193 this.eventManager.addEventListener("selectionChange", this, true);
194 this.hashInstance = this.createLayerHashTable();
195 this.hashTrackInstance = this.createTrackHashTable();
196 this.hashLayerNumber = this.createLayerNumberHash();
197 this.hashElementMapToLayer = this.createElementMapToLayer();
198 this.initTimelineView();
199
200
201 } 223 }
202 }, 224 },
203 225
204 handleCloseDocument: {
205 value: function(event) {
206 this.clearTimelinePanel();
207 }
208 },
209
210 handleSwitchDocument : {
211 value: function(event) {
212 // Handle document change.
213 this.handleOnOpenDocument();
214 }
215 },
216
217 willDraw:{ 226 willDraw:{
218 value:function () { 227 value:function () {
219 if (this._isLayer) { 228 if (this._isLayer) {
@@ -223,8 +232,36 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
223 } 232 }
224 }, 233 },
225 /* === END: Draw cycle === */ 234 /* === END: Draw cycle === */
226
227 /* === BEGIN: Controllers === */ 235 /* === BEGIN: Controllers === */
236 // Bind all document-specific events (pass in true to unbind)
237 _bindDocumentEvents : {
238 value: function(boolUnbi