aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorJonathan Duran2012-02-28 13:31:34 -0800
committerJonathan Duran2012-02-28 13:31:34 -0800
commit1f1e6265c982f09a97271788b138e4c8f805fc7a (patch)
tree109bce95ed03c7bc9b9e201e7caa7d61284a0757 /js/panels
parent154f42e51464a51a83952d4293ef730cd1180e35 (diff)
downloadninja-1f1e6265c982f09a97271788b138e4c8f805fc7a.tar.gz
Timeline : Deleting Layer deletes the element, Deleting Layer selects another layer
Signed-off-by: Kruti Shah <kruti.shah@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js37
1 files changed, 29 insertions, 8 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 85ce6a20..01b03531 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -479,6 +479,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
479 dLayer[hashVariable].deleted = false; 479 dLayer[hashVariable].deleted = false;
480 this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); 480 this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track);
481 this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); 481 this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el);
482 this.selectLayer(event.detail._layerPosition);
482 break; 483 break;
483 484
484 } 485 }
@@ -498,7 +499,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
498 hashVariable++; 499 hashVariable++;
499 } 500 }
500 this.application.ninja.currentSelectedContainer = parentNode; 501 this.application.ninja.currentSelectedContainer = parentNode;
501 //NJevent('breadCrumbTrail', {"element":parentNode, "setFlag":this._setBreadCrumb});
502 } else { 502 } else {
503 dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); 503 dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID);
504 while (dLayer[hashVariable]) { 504 while (dLayer[hashVariable]) {
@@ -506,6 +506,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
506 dLayer[hashVariable].deleted = false; 506 dLayer[hashVariable].deleted = false;
507 this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); 507 this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track);
508 this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); 508 this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el);
509 this.selectLayer(event.detail._layerPosition);
509 break; 510 break;
510 511
511 } 512 }
@@ -578,7 +579,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
578 this.arrTracks.splice(myIndex, 0, newTrack); 579 this.arrTracks.splice(myIndex, 0, newTrack);
579 this.arrLayers.splice(myIndex, 0, thingToPush); 580 this.arrLayers.splice(myIndex, 0, thingToPush);
580 this._LayerUndoPosition = myIndex; 581 this._LayerUndoPosition = myIndex;
581 this.selectLayer(myIndex); 582// this.selectLayer(myIndex);
582 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 583 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
583 this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); 584 this.hashInstance.setItem(this._hashKey, thingToPush, myIndex);
584 this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); 585 this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex);
@@ -591,12 +592,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
591 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 592 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
592 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); 593 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition);
593 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); 594 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition);
594 this.selectLayer(0); 595// this.selectLayer(0);
595 596
596 } 597 }
597 598
598 if(this._openDoc){ 599 if(this._openDoc){
599 this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.currentLayerSelected); 600 var selectedIndex = this.getLayerIndexByID(thingToPush.layerID)
601 this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.arrLayers[selectedIndex]);
600 this._openDoc=false; 602 this._openDoc=false;
601 } 603 }
602 this._LayerUndoObject = thingToPush; 604 this._LayerUndoObject = thingToPush;
@@ -605,6 +607,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
605 this._TrackUndoObject = newTrack; 607 this._TrackUndoObject = newTrack;
606 608
607 609
610
608 } 611 }
609 } 612 }
610 }, 613 },
@@ -627,6 +630,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
627// ElementMediator.deleteElements(dLayer[myIndex].element); 630// ElementMediator.deleteElements(dLayer[myIndex].element);
628 this.arrLayers.splice(k, 1); 631 this.arrLayers.splice(k, 1);
629 this.arrTracks.splice(k, 1); 632 this.arrTracks.splice(k, 1);
633 if(k>0){
634 this.selectLayer(k-1);
635 }else{
636 this.selectLayer(k)
637 }
630 break; 638 break;
631 } 639 }
632 k++; 640 k++;
@@ -647,7 +655,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
647 hashVariable++; 655 hashVariable++;
648 } 656 }
649 this.application.ninja.currentSelectedContainer = parentNode; 657 this.application.ninja.currentSelectedContainer = parentNode;
650 // NJevent('breadCrumbTrail', {"element":parentNode, "setFlag":this._setBreadCrumb});
651 } 658 }
652 else { 659 else {
653 dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); 660 dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID);
@@ -661,6 +668,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
661// ElementMediator.deleteElements(dLayer[myIndex].element); 668// ElementMediator.deleteElements(dLayer[myIndex].element);
662 this.arrLayers.splice(k, 1); 669 this.arrLayers.splice(k, 1);
663 this.arrTracks.splice(k, 1); 670 this.arrTracks.splice(k, 1);
671 if(k>0){
672 this.selectLayer(k-1);
673 }else{
674 this.selectLayer(k);
675 }
664 break; 676 break;
665 } 677 }
666 k++; 678 k++;
@@ -684,13 +696,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
684 this.arrTracks.splice(myIndex, 1); 696 this.arrTracks.splice(myIndex, 1);
685 this._LayerUndoIndex = this._LayerUndoObject.layerID; 697 this._LayerUndoIndex = this._LayerUndoObject.layerID;
686 this._LayerUndoPosition = myIndex; 698 this._LayerUndoPosition = myIndex;
687 ElementMediator.deleteElements(dLayer[myIndex].ele); 699
700 if(myIndex===0){
701 this.selectLayer(0);
702 }
703 else{
704 this.selectLayer(myIndex-1);
705 }
706 ElementMediator.deleteElements(dLayer[myIndex].elementsList);
688 707
689 } else { 708 } else {
690 dLayer = this.hashInstance.getItem(this._hashKey); 709 dLayer = this.hashInstance.getItem(this._hashKey);
691 dTrack = this.hashTrackInstance.getItem(this._hashKey); 710 dTrack = this.hashTrackInstance.getItem(this._hashKey);
692 dLayer[this.arrLayers.length - 1].deleted = true; 711 dLayer[this.arrLayers.length - 1].deleted = true;
693 ElementMediator.deleteElements(dLayer[this.arrLayers.length - 1].ele); 712 ElementMediator.deleteElements(dLayer[this.arrLayers.length - 1].elementsList);
694 this._LayerUndoPosition = this.arrLayers.length - 1; 713 this._LayerUndoPosition = this.arrLayers.length - 1;
695 this._LayerUndoObject = this.arrLayers.pop(); 714 this._LayerUndoObject = this.arrLayers.pop();
696 this._LayerUndoIndex = this._LayerUndoObject.layerID; 715 this._LayerUndoIndex = this._LayerUndoObject.layerID;
@@ -913,7 +932,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
913 if(this.selectedKeyframes){ 932 if(this.selectedKeyframes){
914 this.deselectTweens(); 933 this.deselectTweens();
915 } 934 }
916 935
917 for (i = 0; i < arrLayersLength; i++) { 936 for (i = 0; i < arrLayersLength; i++) {
918 if (i === layerIndex) { 937 if (i === layerIndex) {
919 this.arrLayers[i].isSelected = true; 938 this.arrLayers[i].isSelected = true;
@@ -939,6 +958,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
939 this.currentLayerSelected = null; 958 this.currentLayerSelected = null;
940 this.currentTrackSelected = null; 959 this.currentTrackSelected = null;
941 } 960 }
961
942 } 962 }
943 }, 963 },
944 964
@@ -1030,6 +1050,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1030 1050
1031 NJevent('newLayer', this) 1051 NJevent('newLayer', this)
1032 1052
1053
1033 } 1054 }
1034 }, 1055 },
1035 unexecute:{ 1056 unexecute:{