aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js75
1 files changed, 51 insertions, 24 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index f56eaf74..c21fa22b 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -115,6 +115,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
115 this.eventManager.addEventListener("deleteSelection", this, false); 115 this.eventManager.addEventListener("deleteSelection", this, false);
116 this.hashInstance=this.createLayerHashTable(); 116 this.hashInstance=this.createLayerHashTable();
117 this.hashTrackInstance=this.createTrackHashTable(); 117 this.hashTrackInstance=this.createTrackHashTable();
118 this.hashLayerNumber = this.createLayerNumberHash();
118 this.initTimelineView(); 119 this.initTimelineView();
119 } 120 }
120 }, 121 },
@@ -227,6 +228,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
227 this._firstTimeLoaded=false; 228 this._firstTimeLoaded=false;
228 }else{ 229 }else{
229 while(this.arrLayers.pop()){ 230 while(this.arrLayers.pop()){
231
230 } 232 }
231 while(this.arrTracks.pop()){ 233 while(this.arrTracks.pop()){
232 } 234 }
@@ -241,7 +243,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
241 this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey); 243 this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey);
242 this._hashFind = true; 244 this._hashFind = true;
243 } 245 }
246 this.currentLayerNumber = 0;
244 NJevent('newLayer',event.detail); 247 NJevent('newLayer',event.detail);
248 this.selectLayer(0);
249
245 250
246 } 251 }
247 252
@@ -336,6 +341,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
336 341
337 // Build the thingToPush object 342 // Build the thingToPush object
338 343
344 this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey);
345 if(this.currentLayerNumber===undefined){
346 this.currentLayerNumber = 0 ;
347 }
339 this.currentLayerNumber = this.currentLayerNumber +1; 348 this.currentLayerNumber = this.currentLayerNumber +1;
340 newLayerName = "Layer " + this.currentLayerNumber; 349 newLayerName = "Layer " + this.currentLayerNumber;
341 thingToPush.layerName = newLayerName; 350 thingToPush.layerName = newLayerName;
@@ -393,19 +402,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
393 } 402 }
394 this.layerRepetition.selectedIndexes = [myIndex]; 403 this.layerRepetition.selectedIndexes = [myIndex];
395 */ 404 */
396 405 this.selectLayer(myIndex);
397 this.selectLayer(myIndex); 406 this.hashLayerNumber.setItem(this._hashKey,thingToPush);
398
399 this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); 407 this.hashInstance.setItem(this._hashKey,thingToPush,myIndex);
400 this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); 408 this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex);
409
401 } else { 410 } else {
402 this.arrLayers.splice(0, 0, thingToPush); 411 this.arrLayers.splice(0, 0, thingToPush);
403 this.arrTracks.splice(0, 0, newTrack); 412 this.arrTracks.splice(0, 0, newTrack);
404 thingToPush.layerPosition=this.arrLayers.length-1; 413 thingToPush.layerPosition=this.arrLayers.length-1;
405 newTrack.trackPosition=this.arrTracks.length-1; 414 newTrack.trackPosition=this.arrTracks.length-1;
406 this.currentLayerSelected= this.arrLayers[this.arrLayers.length-1];
407 this.currentTrackSelected=this.arrTracks[this.arrTracks.length-1];
408 this._LayerUndoPosition = this.arrLayers.length-1; 415 this._LayerUndoPosition = this.arrLayers.length-1;
416 this.hashLayerNumber.setItem(this._hashKey,thingToPush);
409 this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition); 417 this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition);
410 this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition); 418 this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition);
411 419
@@ -414,8 +422,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
414 this._LayerUndoIndex = thingToPush.layerID ; 422 this._LayerUndoIndex = thingToPush.layerID ;
415 this._LayerUndoStatus = true; 423 this._LayerUndoStatus = true;
416 this._TrackUndoObject = newTrack; 424 this._TrackUndoObject = newTrack;
425 }
417 426
418 }
419 427
420 428
421 } 429 }
@@ -569,19 +577,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
569 577
570 handleElementAdded: { 578 handleElementAdded: {
571 value: function(event) { 579 value: function(event) {
572 this.layerElement=event.detail; 580
573 if(!!this.layerRepetition.selectedIndexes){ 581 this.currentLayerSelected.element.push(event.detail)
574 this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes]; 582
575 this.currentTrackSelected = this.arrTracks[this.layerRepetition.selectedIndexes]; 583
576 if(this.currentTrackSelected.isAnimated){
577 alert("cannot add divs an further since the track is animated");
578 }else{
579 this.currentLayerSelected.element.push(event.detail)
580 }
581 }
582 else{
583 this.currentLayerSelected.element.push(event.detail);
584 }
585 } 584 }
586 }, 585 },
587 586
@@ -606,10 +605,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
606 value: function(event) { 605 value: function(event) {
607 var length; 606 var length;
608 this.deleteElement = event.detail; 607 this.deleteElement = event.detail;
609
610 if(!!this.layerRepetition.selectedIndexes){
611 this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes];
612 }
613 length =this.currentLayerSelected.element.length-1; 608 length =this.currentLayerSelected.element.length-1;
614 while(length >= 0){ 609 while(length >= 0){
615 if(this.currentLayerSelected.element[length]===this.deleteElement){ 610 if(this.currentLayerSelected.element[length]===this.deleteElement){
@@ -677,7 +672,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
677 writable:true 672 writable:true
678 }, 673 },
679 674
680 setItem: { 675 setItem: {
681 value: function(key,value,index) { 676 value: function(key,value,index) {
682// console.log(this.application.ninja.currentSelectedContainer) 677// console.log(this.application.ninja.currentSelectedContainer)
683 if(hashLayerObject[key]===undefined){ 678 if(hashLayerObject[key]===undefined){
@@ -706,6 +701,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
706 return hashLayerObject[key]; 701 return hashLayerObject[key];
707 } 702 }
708 } 703 }
704
709 }); 705 });
710 706
711 return hashLayerObject; 707 return hashLayerObject;
@@ -727,6 +723,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
727 value: function(key,value,index) { 723 value: function(key,value,index) {
728 if(hashTrackObject[key]===undefined){ 724 if(hashTrackObject[key]===undefined){
729 hashTrackObject[key]={}; 725 hashTrackObject[key]={};
726
730 } 727 }
731 728
732 if(hashTrackObject[key][index]!== undefined){ 729 if(hashTrackObject[key][index]!== undefined){
@@ -752,12 +749,42 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
752 return hashTrackObject[key]; 749 return hashTrackObject[key];
753 } 750 }
754 } 751 }
752
753
755 }); 754 });
756 755
757 return hashTrackObject; 756 return hashTrackObject;
758 757
759 } 758 }
760 }, 759 },
760 createLayerNumberHash:{
761 value:function(key,value){
762 var hashLayerNumberObject ;
763
764 hashLayerNumberObject = Object.create(Object.prototype, {
765
766 setItem: {
767 value: function(key,value) {
768 if(value!==undefined){
769
770 hashLayerNumberObject[key]= value.layerID ;
771
772 }
773 }
774 },
775
776 getItem: {
777 value: function(key) {
778 if(hashLayerNumberObject[key]=== undefined){
779 return;
780 }
781 return hashLayerNumberObject[key];
782 }
783 }
784 });
785 return hashLayerNumberObject ;
786 }
787