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.js79
1 files changed, 75 insertions, 4 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 470062ba..12b481de 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -243,6 +243,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
243 value: false 243 value: false
244 }, 244 },
245 245
246 _areTracksCollapsing: {
247 value: false
248 },
249
246 _currentOpenSpanMenu: { 250 _currentOpenSpanMenu: {
247 value: false 251 value: false
248 }, 252 },
@@ -687,6 +691,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
687 // We have shuffled layers, so we need to update this.selectedLayers. 691 // We have shuffled layers, so we need to update this.selectedLayers.
688 this.selectLayers([]) 692 this.selectLayers([])
689 } 693 }
694
695 // Do we need to scroll the layers?
696 if (this._areTracksCollapsing !== false) {
697 //console.log("diddraw: user_layers, layout_tracks", this.user_layers.scrollTop, this.layout_tracks.scrollTop);
698 //this.layout_tracks.scrollTop = this.user_layers.scrollTop;\
699 this.layout_tracks.scrollTop = this._areTracksCollapsing;
700 this._areTracksCollapsing = false;
701 }
690 } 702 }
691 }, 703 },
692 704
@@ -898,6 +910,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
898 this.eventManager.addEventListener("updatedID", this.handleLayerIdUpdate.bind(this), false); 910 this.eventManager.addEventListener("updatedID", this.handleLayerIdUpdate.bind(this), false);
899 this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); 911 this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false);
900 this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); 912 this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false);
913 this.play_button.addEventListener("click", this.handlePlayButtonClick.bind(this), false);
901 914
902 this.addPropertyChangeListener("currentDocument.model.domContainer", this); 915 this.addPropertyChangeListener("currentDocument.model.domContainer", this);
903 916
@@ -1073,15 +1086,56 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1073 } 1086 }
1074 }, 1087 },
1075 1088
1089 handlePlayButtonClick:{
1090 value:function(ev){
1091 this.application.ninja.appModel.livePreview = !this.application.ninja.appModel.livePreview;
1092
1093 if (this.application.ninja.appModel.livePreview) {
1094 this.play_button.classList.remove("playbutton");
1095 this.play_button.classList.add("pausebutton");
1096
1097 } else {
1098 this.play_button.classList.remove("pausebutton");
1099 this.play_button.classList.add("playbutton");
1100 }
1101 }
1102 },
1103
1076 handleKeyframeShortcut:{ 1104 handleKeyframeShortcut:{
1077 value:function(action){ 1105 value:function(action){
1078 var tempEv = {}; 1106 var tempEv = {};
1079 tempEv.offsetX = this.playheadmarker.offsetLeft; 1107 tempEv.offsetX = this.playheadmarker.offsetLeft;
1080 tempEv.actionType = action; 1108 tempEv.actionType = action;
1081 if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { 1109
1082 this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); 1110 if (this.currentLayersSelected === false) {
1083 } else { 1111 // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently.
1084 // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. 1112 return;
1113 }
1114
1115 // Okay. We need to get the correct layer(s). For each currentElementSelected,
1116 // loop through trackRepetition.childComponents and compare to stageElement.
1117 // If they match, that's one of the components that needs the event.
1118 var i = 0,
1119 j = 0,
1120 currentElementsSelectedLength = this.currentElementsSelected.length,
1121 trackRepLength = this.trackRepetition.childComponents.length,
1122 arrTargetIndexes = [],
1123 arrTargetIndexesLength = 0;
1124
1125
1126 for (i = 0; i < trackRepLength; i++) {
1127 var currentElement = this.trackRepetition.childComponents[i].stageElement;
1128 for (j = 0; j < currentElementsSelectedLength; j++) {
1129 if (currentElement === this.currentElementsSelected[j]) {
1130 arrTargetIndexes.push(i);
1131 }
1132 }
1133 }
1134 arrTargetIndexesLength = arrTargetIndexes.length;
1135
1136 // Now we have an array of things that need to handle the event.
1137 for (i = 0; i < arrTargetIndexesLength; i++) {
1138 this.trackRepetition.childComponents[arrTargetIndexes[i]].handleKeyboardShortcut(tempEv);
1085 } 1139 }
1086 } 1140 }
1087 }, 1141 },
@@ -1097,11 +1151,25 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1097 this.drawTimeMarkers(); 1151 this.drawTimeMarkers();
1098 } 1152 }
1099 }, 1153 },
1154
1155 synchScrollbars: {
1156 value: function(intScrollBy) {
1157 //this.updateLayerScroll();
1158 //this.user_layers.scrollTop = 0;
1159 //this.layout_tracks.scrollTop = this.user_layers.scrollTop;
1160 //console.log("synch: user_layers, layout_tracks", this.user_layers.scrollTop, this.layout_tracks.scrollTop);
1161 this._areTracksCollapsing = this.layout_tracks.scrollTop - intScrollBy;
1162 this.needsDraw = true;
1163
1164 }
1165 },
1100 1166
1101 updateLayerScroll:{ 1167 updateLayerScroll:{
1102 value:function () { 1168 value:function () {
1169 //console.log("TimelinePanel.updateLayerScroll")
1103 this._areTracksScrolling = true; 1170 this._areTracksScrolling = true;
1104 this.needsDraw = true; 1171 this.needsDraw = true;
1172
1105 } 1173 }
1106 }, 1174 },
1107 1175
@@ -1188,6 +1256,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1188 if (this.currentLayersSelected !== false) { 1256 if (this.currentLayersSelected !== false) {
1189 this.currentLayersSelected = false; 1257 this.currentLayersSelected = false;
1190 } 1258 }
1259
1260 // Deselect any tweens
1261 this.deselectTweens();
1191 1262
1192 // If we are actually going to be selecting things, create an empty array to use 1263 // If we are actually going to be selecting things, create an empty array to use
1193 if (arrSelectedIndexesLength > 0) { 1264 if (arrSelectedIndexesLength > 0) {