aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js426
1 files changed, 216 insertions, 210 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 2c98233c..9c782787 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -49,6 +49,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
49 value: function() { 49 value: function() {
50 if (this._boolCacheArrays) { 50 if (this._boolCacheArrays) {
51 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 51 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
52
52 } 53 }
53 } 54 }
54 }, 55 },
@@ -69,6 +70,39 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
69 set:function (newVal) { 70 set:function (newVal) {
70 if (newVal !== this._currentLayerNumber) { 71 if (newVal !== this._currentLayerNumber) {
71 this._currentLayerNumber = newVal; 72 this._currentLayerNumber = newVal;
73 this._setCurrentLayerNumber();
74 }
75 }
76 },
77
78 _setCurrentLayerNumber:{
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;
72 } 106 }
73 } 107 }
74 }, 108 },
@@ -140,6 +174,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
140 } 174 }
141 }, 175 },
142 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
143 _isLayer:{ 193 _isLayer:{
144 value:false 194 value:false
145 }, 195 },
@@ -188,11 +238,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
188 value: function(boolUnbind) { 238 value: function(boolUnbind) {
189 var arrEvents = ["deleteLayerClick", 239 var arrEvents = ["deleteLayerClick",
190 "newLayer", 240 "newLayer",
191 "deleteLayer", 241 "deleteLayer",
192 "layerBinding",
193 "elementAdded", 242 "elementAdded",
194 "elementDeleted", 243 "elementDeleted",
195 "deleteSelection",
196 "selectionChange"], 244 "selectionChange"],
197 i, 245 i,
198 arrEventsLength = arrEvents.length; 246 arrEventsLength = arrEvents.length;
@@ -205,6 +253,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
205 for (i = 0; i < arrEventsLength; i++) { 253 for (i = 0; i < arrEventsLength; i++) {
206 this.eventManager.addEventListener(arrEvents[i], this, false); 254 this.eventManager.addEventListener(arrEvents[i], this, false);
207 } 255 }
256 Object.defineBinding(this, "breadCrumbContainer", {
257 boundObject: this.application.ninja,
258 boundObjectPropertyPath:"currentSelectedContainer",
259 oneway: true
260 });
208 } 261 }
209 } 262 }
210 }, 263 },
@@ -231,8 +284,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
231 value:function () { 284 value:function () {
232 var myIndex; 285 var myIndex;
233 this.drawTimeMarkers(); 286 this.drawTimeMarkers();
234 this._hashKey = "123"; 287
235
236 // Document switching 288 // Document switching
237 // Check to see if we have saved timeline information in the currentDocument. 289 // Check to see if we have saved timeline information in the currentDocument.
238 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { 290 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
@@ -241,41 +293,54 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
241 this.application.ninja.currentDocument.isTimelineInitialized = true; 293 this.application.ninja.currentDocument.isTimelineInitialized = true;
242 this.application.ninja.currentDocument.tlArrLayers = []; 294 this.application.ninja.currentDocument.tlArrLayers = [];
243 this.application.ninja.currentDocument.tlArrTracks = []; 295 this.application.ninja.currentDocument.tlArrTracks = [];
244 296 this.application.ninja.currentDocument.tllayerNumber = 0;
245 297 this.application.ninja.currentDocument.tlLayerHashTable=[];
298 this.hashKey = this.application.ninja.currentSelectedContainer.uuid;
299
246 // Loop through the DOM of the document to find layers and animations. 300 // Loop through the DOM of the document to find layers and animations.
247 // Fire off events as they are found. 301 // Fire off events as they are found.
248 _firstLayerDraw = false;
249 if(!this.application.ninja.documentController.creatingNewFile){ 302 if(!this.application.ninja.documentController.creatingNewFile){
250 if(this.application.ninja.currentDocument.documentRoot.children[0]){ 303 if(this.application.ninja.currentDocument.documentRoot.children[0]){
251 myIndex=0; 304 myIndex=0;
252 while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) 305 while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
253 { 306 {
254 this._openDoc=true; 307 this._openDoc=true;
255 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) 308 this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]);
256 myIndex++; 309 myIndex++;
257 } 310 }
258 } 311 }
259 else{ 312 else{
260 NJevent('newLayer', this._hashKey); 313 this.restoreLayer(1);
261 this.selectLayer(0); 314 this.selectLayer(0);
262 } 315 }
263 }else{ 316 }else{
264 NJevent('newLayer', this._hashKey); 317 this.createNewLayer(1);
265 this.selectLayer(0); 318 this.selectLayer(0);
266 319
267 } 320 }
268 _firstLayerDraw = true;
269
270 // After recreating the tracks and layers, store the result in the currentDocument. 321 // After recreating the tracks and layers, store the result in the currentDocument.
271 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 322 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
323 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber;
324 this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance;
325 this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer;
326 this.application.ninja.currentDocument.hashKey=this.hashKey;
327
328
272 329
273 } else { 330 } else {
274 // we do have information stored. Use it. 331 // we do have information stored. Use it.
275 this._boolCacheArrays = false; 332 this._boolCacheArrays = false;
276 //this.arrLayers = []; 333 //this.arrLayers = [];
277 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; 334 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
335 this.arrTracks = this.application.ninja.currentDocument.tlArrTracks;
336 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
337 this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable;
338 this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable;
339 this.hashKey = this.application.ninja.currentDocument.hashKey;
340 this.selectLayer(0);
278 this._boolCacheArrays = true; 341 this._boolCacheArrays = true;
342
343
279 } 344 }
280 345
281 // Redraw all the things 346 // Redraw all the things
@@ -301,7 +366,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
301