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.js62
1 files changed, 44 insertions, 18 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index a5cde00f..d7d5328e 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -224,15 +224,19 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
224 224
225 this._hashKey = "123"; 225 this._hashKey = "123";
226 _firstLayerDraw = false; 226 _firstLayerDraw = false;
227 if(this.application.ninja.currentDocument.documentRoot.children[0]){ 227 if(!this.application.ninja.documentController.creatingNewFile){
228 myIndex=0; 228 if(this.application.ninja.currentDocument.documentRoot.children[0]){
229 while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) 229 myIndex=0;
230 { 230 while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
231 this._openDoc=true; 231 {
232 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) 232 this._openDoc=true;
233// this.selectLayer(myIndex); 233 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
234// TimelineTrack.retrieveStoredTweens(); 234 myIndex++;
235 myIndex++; 235 }
236 }
237 else{
238 NJevent('newLayer', this._hashKey);
239 this.selectLayer(0);
236 } 240 }
237 }else{ 241 }else{
238 NJevent('newLayer', this._hashKey); 242 NJevent('newLayer', this._hashKey);
@@ -242,6 +246,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
242 _firstLayerDraw = true; 246 _firstLayerDraw = true;
243 } 247 }
244 }, 248 },
249
250 clearTimelinePanel : {
251 value: function() {
252 console.log('clearing timeline...')
253 this.arrTracks = null;
254 this.arrLayers = null;
255 this.currentLayerNumber = 0;
256 this.currentLayerSelected = null;
257 this.currentTrackSelected = null;
258 this.selectedKeyframes = [];
259 this.selectedTweens = [];
260 this._captureSelection = false;
261 this._openDoc = false;
262 this.end_hottext.value = 25;
263 this.updateTrackContainerWidth();
264 this.needsDraw = true;
265 }
266 },
245 267
246 updateTrackContainerWidth:{ 268 updateTrackContainerWidth:{
247 value: function(){ 269 value: function(){
@@ -318,6 +340,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
318 value:function (event) { 340 value:function (event) {
319 this._isLayer = true; 341 this._isLayer = true;
320 this.needsDraw = true; 342 this.needsDraw = true;
343 this.application.ninja.selectionController.executeSelectElement();
321 } 344 }
322 }, 345 },
323 346
@@ -459,6 +482,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
459 thingToPush.elementsList = []; 482 thingToPush.elementsList = [];
460 thingToPush.deleted = false; 483 thingToPush.deleted = false;
461 thingToPush.isSelected = false; 484 thingToPush.isSelected = false;
485 thingToPush.created=false;
462 if (_firstLayerDraw) { 486 if (_firstLayerDraw) {
463 487
464 this.application.ninja.currentSelectedContainer.uuid=this._hashKey; 488 this.application.ninja.currentSelectedContainer.uuid=this._hashKey;
@@ -469,7 +493,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
469 if(this._openDoc){ 493 if(this._openDoc){
470 event.detail.ele.uuid =nj.generateRandom(); 494 event.detail.ele.uuid =nj.generateRandom();
471 thingToPush.elementsList.push(event.detail.ele); 495 thingToPush.elementsList.push(event.detail.ele);
472 this._openDoc=false;
473 } 496 }
474 497
475 newTrack.trackID = this.currentLayerNumber; 498 newTrack.trackID = this.currentLayerNumber;
@@ -499,7 +522,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
499 this.arrTracks.splice(myIndex, 0, newTrack); 522 this.arrTracks.splice(myIndex, 0, newTrack);
500 this.arrLayers.splice(myIndex, 0, thingToPush); 523 this.arrLayers.splice(myIndex, 0, thingToPush);
501 this._LayerUndoPosition = myIndex; 524 this._LayerUndoPosition = myIndex;
502// this.selectLayer(myIndex); 525 this.selectLayer(myIndex);
503 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 526 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
504 this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); 527 this.hashInstance.setItem(this._hashKey, thingToPush, myIndex);
505 this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); 528 this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex);
@@ -512,16 +535,19 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
512 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 535 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
513 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); 536 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition);
514 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); 537 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition);
515// this.selectLayer(0); 538 this.selectLayer(0);
539
540 }
516 541
542 if(this._openDoc){
543 this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.currentLayerSelected);
544 this._openDoc=false;
517 } 545 }
518 this._LayerUndoObject = thingToPush; 546 this._LayerUndoObject = thingToPush;
519 this._LayerUndoIndex = thingToPush.layerID; 547 this._LayerUndoIndex = thingToPush.layerID;
520 this._LayerUndoStatus = true; 548 this._LayerUndoStatus = true;
521 this._TrackUndoObject = newTrack; 549 this._TrackUndoObject = newTrack;
522// if(_firstLayerDraw){ 550
523// this.application.ninja.selectionController.executeSelectElement();
524// }
525 551
526 } 552 }
527 } 553 }
@@ -846,9 +872,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
846 this.trackRepetition.selectedIndexes = [layerIndex]; 872 this.trackRepetition.selectedIndexes = [layerIndex];
847 this.currentLayerSelected = this.arrLayers[layerIndex]; 873 this.currentLayerSelected = this.arrLayers[layerIndex];
848 this.currentTrackSelected = this.arrTracks[layerIndex]; 874 this.currentTrackSelected = this.arrTracks[layerIndex];
849 /*if(this._captureSelection){ 875 if(this._captureSelection){
850 this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList) 876 this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList)
851 }*/ 877 }
852 this._captureSelection = true; 878 this._captureSelection = true;
853 } else { 879 } else {
854 this.layerRepetition.selectedIndexes = null; 880 this.layerRepetition.selectedIndexes = null;