aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-06-28 09:48:44 -0700
committerJon Reid2012-06-28 09:48:44 -0700
commitb50b720e7b34cea86e9aabfb27e843376508b00e (patch)
tree5f91b29fe56040cf2eb315bc7a803ed51c3b9354 /js
parent338d3fdadf3a4b758e855dd48b325ed3099443ea (diff)
downloadninja-b50b720e7b34cea86e9aabfb27e843376508b00e.tar.gz
Timeline: Better deselection of tweens when selecting/deselecting layers.
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js45
1 files changed, 32 insertions, 13 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 50171260..87cf1e4f 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -1217,20 +1217,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1217 arrCurrentElementsSelected = []; 1217 arrCurrentElementsSelected = [];
1218 var matchedValues = 0; 1218 var matchedValues = 0;
1219 1219
1220 for(i=0;i<arrSelectedIndexesLength;i++){ 1220 /*
1221 for(j=0;j<currentLayersSelectedLength;j++){ 1221 if (arrSelectedIndexesLength !== 0) {
1222 for(i=0;i<arrSelectedIndexesLength;i++){
1223 for(j=0;j<currentLayersSelectedLength;j++){
1224
1225 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
1226 matchedValues+=1;
1227 }
1228 }
1229 }
1230
1231 if(matchedValues === arrSelectedIndexesLength){
1232 return;
1233 }
1234 }
1222 1235
1223 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
1224 matchedValues+=1;
1225 }
1226 }
1227 }
1228 1236
1229 if(matchedValues === arrSelectedIndexesLength){
1230 return;
1231 }
1232 1237
1233 /*
1234 // TODO: this should probably check to see if it actually needs to run. 1238 // TODO: this should probably check to see if it actually needs to run.
1235 1239
1236 console.log(arrSelectedIndexes); 1240 console.log(arrSelectedIndexes);
@@ -1266,6 +1270,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1266 if (arrSelectedIndexes.indexOf(i) < 0) { 1270 if (arrSelectedIndexes.indexOf(i) < 0) {
1267 this.arrLayers[i].layerData.isSelected = false; 1271 this.arrLayers[i].layerData.isSelected = false;
1268 this.triggerLayerBinding(i); 1272 this.triggerLayerBinding(i);
1273
1274 // Check to see if this layer, that we're deselecting, has
1275 // any selected keyframes associated with it. If it does, deselect them.
1276 for (var j = 0; j < this.selectedTweens.length; j++) {
1277 var currentStageElement;
1278 if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") {
1279 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement;
1280 } else {
1281 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.stageElement;
1282 }
1283 if (this.arrLayers[i].layerData.stageElement === currentStageElement) {
1284 this.selectedTweens[j].deselectTween();
1285 this.selectedTweens.splice(j, 1);
1286 }
1287 }
1269 } 1288 }
1270 } 1289 }
1271 } 1290 }
@@ -1273,8 +1292,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1273 this.currentLayersSelected = false; 1292 this.currentLayersSelected = false;
1274 } 1293 }
1275 1294
1276 // Deselect any tweens 1295 // Deselect tweens
1277 this.deselectTweens(); 1296 //this.deselectTweens();
1278 1297
1279 1298
1280 // If we are actually going to be selecting things, create an empty array to use 1299 // If we are actually going to be selecting things, create an empty array to use