aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js163
1 files changed, 157 insertions, 6 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index d782e96d..ef85e067 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -83,7 +83,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
83 }, 83 },
84 84
85 _currentLayerSelected:{ 85 _currentLayerSelected:{
86 value:null 86 value: false
87 }, 87 },
88 currentLayerSelected:{ 88 currentLayerSelected:{
89 get:function () { 89 get:function () {
@@ -109,14 +109,38 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
109 return; 109 return;
110 } 110 }
111 if (newVal !== this._selectedLayerID) { 111 if (newVal !== this._selectedLayerID) {
112 //console.log('TimelinePanel.selectLayerID.set')
112 var selectIndex = this.getLayerIndexByID(newVal); 113 var selectIndex = this.getLayerIndexByID(newVal);
113 this._selectedLayerID = newVal; 114 this._selectedLayerID = newVal;
114 this._captureSelection = true; 115 this._captureSelection = true;
115 this.selectLayer(selectIndex, true); 116 if (this.currentLayerSelected !== false) {
117 this.selectLayer(selectIndex, true);
118 }
119 if (this.currentLayersSelected !== false) {
120 this.selectLayers(this.currentLayersSelected);
121 }
122 if ((this.currentLayersSelected === false) && (this.currentLayerSelected === false)) {
123 this.selectLayers([]);
124 }
125
116 } 126 }
117 } 127 }
118 }, 128 },
119 129
130 _currentLayersSelected:{
131 value:[]
132 },
133 currentLayersSelected:{
134 get:function () {
135 return this._currentLayersSelected;
136 },
137 set:function (newVal) {
138 //console.log("TimelinePanel.currentLayersSelected.set, ", newVal);
139 this._currentLayersSelected = newVal;
140 this.cacheTimeline();
141 }
142 },
143
120 _millisecondsOffset:{ 144 _millisecondsOffset:{
121 value:1000 145 value:1000
122 }, 146 },
@@ -418,6 +442,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
418 this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; 442 this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer;
419 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; 443 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber;
420 this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; 444 this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected;
445 this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected;
421 } 446 }
422 } 447 }
423 }, 448 },
@@ -429,7 +454,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
429 this.application.ninja.currentDocument.tlArrLayers = []; 454 this.application.ninja.currentDocument.tlArrLayers = [];
430 this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; 455 this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer;
431 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; 456 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber;
432 this.application.ninja.currentDocument.tlCurrentLayerSelected = null; 457 this.application.ninja.currentDocument.tlCurrentLayerSelected = false;
458 this.application.ninja.currentDocument.tlCurrentLayersSelected = false;
433 } 459 }
434 }, 460 },
435 461
@@ -609,6 +635,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
609 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; 635 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
610 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 636 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
611 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; 637 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected;
638 this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected;
612 639
613 640
614 //debugger; 641 //debugger;
@@ -651,6 +678,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
651 this.checkable_animated.classList.remove("checked"); 678 this.checkable_animated.classList.remove("checked");
652 this.currentLayerNumber = 0; 679 this.currentLayerNumber = 0;
653 this.currentLayerSelected = false; 680 this.currentLayerSelected = false;
681 this.currentLayersSelected = false;
654 this.selectedKeyframes = []; 682 this.selectedKeyframes = [];
655 this.selectedTweens = []; 683 this.selectedTweens = [];
656 this._captureSelection = false; 684 this._captureSelection = false;
@@ -670,7 +698,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
670 value:function (event) { 698 value:function (event) {
671 // Clear the timeline but not the cache 699 // Clear the timeline but not the cache
672 //console.log('TimelinePanel.handleDocumentChange'); 700 //console.log('TimelinePanel.handleDocumentChange');
673// debugger;
674 if(event === undefined){ 701 if(event === undefined){
675 this.application.ninja.currentDocument.setLevel = true; 702 this.application.ninja.currentDocument.setLevel = true;
676 this._boolCacheArrays = false; 703 this._boolCacheArrays = false;
@@ -695,6 +722,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
695 // Ignore extra closeDocument event that fires while there are still documents open. 722 // Ignore extra closeDocument event that fires while there are still documents open.
696 return; 723 return;
697 } 724 }
725 //console.log(event.type);
698 this._boolCacheArrays = false; 726 this._boolCacheArrays = false;
699 this.clearTimelinePanel(); 727 this.clearTimelinePanel();
700 this._boolCacheArrays = true; 728 this._boolCacheArrays = true;
@@ -772,9 +800,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
772 800
773 handleSelectionChange:{ 801 handleSelectionChange:{
774 value:function () { 802 value:function () {
775 var layerIndex, i = 0, arrLayersLength = this.arrLayers.length; 803 var layerIndex,
804 i = 0,
805 j = 0,
806 arrLayersLength = this.arrLayers.length,
807 intNumSelected = this.application.ninja.selectedElements.length;
808
776 this.deselectTweens(); 809 this.deselectTweens();
777 if (this.application.ninja.selectedElements.length === 1) { 810 //console.log("TimelinePanel.handleSelectionChange")
811 if (intNumSelected === 0) {
812 this.selectLayers([]);
813 this.currentLayerSelected = false;
814 this.currentLayersSelected = false;
815 }
816
817 if (intNumSelected === 1) {
818 this.currentLayersSelected = false;
778 if (this.application.ninja.selectedElements[0]) { 819 if (this.application.ninja.selectedElements[0]) {
779 for (i = 0; i < arrLayersLength; i++) { 820 for (i = 0; i < arrLayersLength; i++) {
780 if (this.application.ninja.selectedElements[0].uuid === this.arrLayers[i].layerData.elementsList[0].uuid) { 821 if (this.application.ninja.selectedElements[0].uuid === this.arrLayers[i].layerData.elementsList[0].uuid) {
@@ -786,9 +827,94 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
786 } 827 }
787 } 828 }
788 } 829 }
830
831 if (intNumSelected > 1) {
832 // Build an array of indexes of selected layers to give to the selectLayers method
833 var arrSelectedIndexes = [];
834 this.currentLayerSelected = false;
835 for (i = 0; i < intNumSelected; i++) {
836 var currentCheck = this.application.ninja.selectedElements[i].uuid;
837 //console.log("checking ", currentCheck);
838 for (j = 0; j < arrLayersLength; j++) {
839 //console.log(".......... ", this.arrLayers[j].layerData.elementsList[0].uuid)
840 if (currentCheck === this.arrLayers[j].layerData.elementsList[0].uuid) {
841 //console.log("...............Yes!")
842 arrSelectedIndexes.push(j);
843 }
844 }
845 }
846 this.selectLayers(arrSelectedIndexes);
847 }
848 }
849 },
850
851
852
853 selectLayers:{
854 value:function (arrSelectedIndexes) {
855
856 var i = 0,
857 arrLayersLength = this.arrLayers.length,
858 arrSelectedIndexesLength = arrSelectedIndexes.length,
859 userSelection = false;
860
861 //console.log(arrSelectedIndexes);
862
863
864 if (this.selectedKeyframes) {
865 this.deselectTweens();
866 }
867
868 for (i = 0; i < arrLayersLength; i++) {
869 this.arrLayers[i].layerData.isSelected = false;
870 this.triggerLayerBinding(i);
871 }
872
873 this.currentLayersSelected = false;
874 if (arrSelectedIndexesLength > 0) {
875 this.currentLayersSelected = [];
876 }
877
878
879 for (i = 0; i < arrLayersLength; i++) {
880