diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 184 |
1 files changed, 82 insertions, 102 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 767dc362..f6e0e252 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -95,6 +95,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
95 | this.cacheTimeline(); | 95 | this.cacheTimeline(); |
96 | } | 96 | } |
97 | }, | 97 | }, |
98 | _currentElementsSelected: { | ||
99 | value: [] | ||
100 | }, | ||
101 | currentElementsSelected: { | ||
102 | get: function() { | ||
103 | return this._currentElementsSelected; | ||
104 | }, | ||
105 | set: function(newVal) { | ||
106 | this._currentElementsSelected = newVal; | ||
107 | this.cacheTimeline(); | ||
108 | } | ||
109 | }, | ||
98 | 110 | ||
99 | _selectedLayerID:{ | 111 | _selectedLayerID:{ |
100 | value:false | 112 | value:false |
@@ -506,6 +518,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
506 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 518 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
507 | this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; | 519 | this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; |
508 | this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; | 520 | this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; |
521 | this.application.ninja.currentDocument.tlCurrentElementsSelected = this.currentElementsSelected; | ||
509 | } | 522 | } |
510 | } | 523 | } |
511 | }, | 524 | }, |
@@ -519,6 +532,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
519 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | 532 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
520 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; | 533 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; |
521 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; | 534 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; |
535 | this.application.ninja.currentDocument.tlCurrentElementsSelected = []; | ||
522 | } | 536 | } |
523 | }, | 537 | }, |
524 | 538 | ||
@@ -622,8 +636,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
622 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | 636 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); |
623 | 637 | ||
624 | // Add some event handlers | 638 | // Add some event handlers |
625 | //this.timeline_leftpane.addEventListener("mousedown", this.timelineLeftPanelMousedown.bind(this), false); | 639 | this.timeline_leftpane.addEventListener("mousedown", this.timelineLeftPanelMousedown.bind(this), false); |
626 | this.timeline_leftpane.addEventListener("click", this.timelineLeftPanelMousedown.bind(this), false); | 640 | //this.timeline_leftpane.addEventListener("click", this.timelineLeftPanelMousedown.bind(this), false); |
627 | //this.timeline_leftpane.addEventListener("mouseup", this.timelineLeftPaneMouseup.bind(this), false); | 641 | //this.timeline_leftpane.addEventListener("mouseup", this.timelineLeftPaneMouseup.bind(this), false); |
628 | this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); | 642 | this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); |
629 | this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false); | 643 | this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false); |
@@ -708,8 +722,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
708 | this.currentLayerNumber = storedCurrentLayerNumber; | 722 | this.currentLayerNumber = storedCurrentLayerNumber; |
709 | boolAlreadyInitialized = true; | 723 | boolAlreadyInitialized = true; |
710 | this.application.ninja.currentDocument.setLevel = false; | 724 | this.application.ninja.currentDocument.setLevel = false; |
711 | |||
712 | |||
713 | } else { | 725 | } else { |
714 | //console.log('TimelinePanel.initTimelineForDocument: else fallback'); | 726 | //console.log('TimelinePanel.initTimelineForDocument: else fallback'); |
715 | // we do have information stored. Use it. | 727 | // we do have information stored. Use it. |
@@ -729,6 +741,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
729 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 741 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
730 | this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; | 742 | this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; |
731 | this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; | 743 | this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; |
744 | this.currentElementsSelected = this.application.ninja.currentDocument.tlCurrentElementsSelected; | ||
732 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; | 745 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; |
733 | 746 | ||
734 | 747 | ||
@@ -737,6 +750,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
737 | // this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer; | 750 | // this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer; |
738 | } | 751 | } |
739 | 752 | ||
753 | // TODO: select elements stored in currentElementsSelected. | ||
754 | |||
740 | // Are we only showing animated layers? | 755 | // Are we only showing animated layers? |
741 | if (this.application.ninja.currentDocument.boolShowOnlyAnimated) { | 756 | if (this.application.ninja.currentDocument.boolShowOnlyAnimated) { |
742 | // Fake a click. | 757 | // Fake a click. |
@@ -773,6 +788,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
773 | this.currentLayerNumber = 0; | 788 | this.currentLayerNumber = 0; |
774 | this.currentLayerSelected = false; | 789 | this.currentLayerSelected = false; |
775 | this.currentLayersSelected = false; | 790 | this.currentLayersSelected = false; |
791 | this.currentElementsSelected = []; | ||
776 | this.selectedKeyframes = []; | 792 | this.selectedKeyframes = []; |
777 | this.selectedTweens = []; | 793 | this.selectedTweens = []; |
778 | this._captureSelection = false; | 794 | this._captureSelection = false; |
@@ -878,7 +894,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
878 | this.updateTimeText(currentMillisec); | 894 | this.updateTimeText(currentMillisec); |
879 | } | 895 | } |
880 | }, | 896 | }, |
881 | 897 | ||
882 | handleSelectionChange:{ | 898 | handleSelectionChange:{ |
883 | value:function () { | 899 | value:function () { |
884 | var layerIndex, | 900 | var layerIndex, |
@@ -887,7 +903,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
887 | arrLayersLength = this.arrLayers.length, | 903 | arrLayersLength = this.arrLayers.length, |
888 | intNumSelected = this.application.ninja.selectedElements.length, | 904 | intNumSelected = this.application.ninja.selectedElements.length, |
889 | checkIndex = 0; | 905 | checkIndex = 0; |
890 | 906 | ||
891 | //console.log("TimelinePanel.handleSelectionChange, intNumSelected is ", intNumSelected) | 907 | //console.log("TimelinePanel.handleSelectionChange, intNumSelected is ", intNumSelected) |
892 | 908 | ||
893 | if (intNumSelected === 0) { | 909 | if (intNumSelected === 0) { |
@@ -899,30 +915,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
899 | 915 | ||
900 | this.currentLayerSelected = false; | 916 | this.currentLayerSelected = false; |
901 | this.currentLayersSelected = false; | 917 | this.currentLayersSelected = false; |
902 | } | 918 | } else { |
903 | |||
904 | if (intNumSelected === 1) { | ||
905 | this.currentLayersSelected = false; | ||
906 | if (this.application.ninja.selectedElements[0]) { | ||
907 | checkIndex = this.application.ninja.selectedElements[0].uuid; | ||
908 | for (i = 0; i < arrLayersLength; i++) { | ||
909 | var currIndex = this.arrLayers[i].layerData.elementsList[0].uuid, | ||
910 | layerID = this.arrLayers[i].layerData.layerID, | ||
911 | layerIndex = 0; | ||
912 | if (checkIndex === currIndex) { | ||
913 | layerIndex = this.getLayerIndexByID(layerID); | ||
914 | this._captureSelection = false; | ||
915 | this.selectLayer(layerIndex); | ||
916 | this._captureSelection = true; | ||
917 | } | ||
918 | } | ||
919 | } | ||
920 | } | ||
921 | |||
922 | if (intNumSelected > 1) { | ||
923 | // Build an array of indexes of selected layers to give to the selectLayers method | 919 | // Build an array of indexes of selected layers to give to the selectLayers method |
924 | var arrSelectedIndexes = []; | 920 | var arrSelectedIndexes = []; |
925 | this.currentLayerSelected = false; | 921 | //this.currentLayerSelected = false; |
926 | for (i = 0; i < intNumSelected; i++) { | 922 | for (i = 0; i < intNumSelected; i++) { |
927 | var currentCheck = this.application.ninja.selectedElements[i].uuid; | 923 | var currentCheck = this.application.ninja.selectedElements[i].uuid; |
928 | //console.log("checking ", currentCheck); | 924 | //console.log("checking ", currentCheck); |
@@ -939,71 +935,71 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
939 | } | 935 | } |
940 | }, | 936 | }, |
941 | 937 | ||
942 | |||
943 | |||
944 | selectLayers:{ | 938 | selectLayers:{ |
945 | value:function (arrSelectedIndexes, userSelection) { | 939 | value:function (arrSelectedIndexes, userSelection) { |
946 | 940 | ||
947 | var i = 0, | 941 | var i = 0, |
948 | arrLayersLength = this.arrLayers.length, | 942 | arrLayersLength = this.arrLayers.length, |
949 | arrSelectedIndexesLength = arrSelectedIndexes.length, | 943 | arrSelectedIndexesLength = arrSelectedIndexes.length, |
950 | arrSelectedLayers = false; | 944 | arrSelectedLayers = false, |
945 | arrCurrentElementsSelected = []; | ||
951 | 946 | ||
952 | if (typeof(userSelection) === "undefined") { | 947 | // Set a default for userSelection if it wasn't passed in the method call. |
948 | if (typeof(userSelection) === "undefined") { | ||
953 | userSelection = false; | 949 | userSelection = false; |
954 | } | 950 | } |
955 | |||
956 | console.log(arrSelectedIndexes); | ||
957 | |||
958 | 951 | ||
959 | if (this.selectedKeyframes) { | 952 | // Deselect tweens if necessary. |
953 | if (this.selectedKeyframes) { | ||
960 | this.deselectTweens(); | 954 | this.deselectTweens(); |
961 | } | 955 | } |
962 | 956 | ||
957 | // deselect all layers. | ||
963 |