From b50b720e7b34cea86e9aabfb27e843376508b00e Mon Sep 17 00:00:00 2001
From: Jon Reid
Date: Thu, 28 Jun 2012 09:48:44 -0700
Subject: Timeline: Better deselection of tweens when selecting/deselecting
 layers.

---
 .../Timeline/TimelinePanel.reel/TimelinePanel.js   | 45 +++++++++++++++-------
 1 file changed, 32 insertions(+), 13 deletions(-)

(limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')

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, {
         		arrCurrentElementsSelected = [];
             var matchedValues = 0;
 
-            for(i=0;i<arrSelectedIndexesLength;i++){
-                for(j=0;j<currentLayersSelectedLength;j++){
+        	/*
+            if (arrSelectedIndexesLength !== 0) {
+	            for(i=0;i<arrSelectedIndexesLength;i++){
+	                for(j=0;j<currentLayersSelectedLength;j++){
+	
+	                    if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
+	                        matchedValues+=1;
+	                    }
+	                }
+	            }
+	
+	            if(matchedValues === arrSelectedIndexesLength){
+	                return;
+	            }
+            } 
 
-                    if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
-                        matchedValues+=1;
-                    }
-                }
-            }
 
-            if(matchedValues === arrSelectedIndexesLength){
-                return;
-            }
 
-        	/*
         	 // TODO: this should probably check to see if it actually needs to run.
 
         	        		console.log(arrSelectedIndexes);
@@ -1266,6 +1270,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
             		if (arrSelectedIndexes.indexOf(i) < 0) {
 						this.arrLayers[i].layerData.isSelected = false;
 	            		this.triggerLayerBinding(i);
+	            		
+	            		// Check to see if this layer, that we're deselecting, has
+	            		// any selected keyframes associated with it.  If it does, deselect them.
+	            		for (var j = 0; j < this.selectedTweens.length; j++) {
+	            			var currentStageElement;
+	            			if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") {
+	            				currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement; 
+	            			} else {
+	            				currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.stageElement;
+	            			}
+	            			if (this.arrLayers[i].layerData.stageElement === currentStageElement) {
+	            				this.selectedTweens[j].deselectTween();
+	            				this.selectedTweens.splice(j, 1);
+	            			}
+	            		}
             		}
             	}
             }
@@ -1273,8 +1292,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
             	this.currentLayersSelected = false;
             }
 
-            // Deselect any tweens
-                this.deselectTweens();
+            // Deselect tweens
+            //this.deselectTweens();
 
             
             // If we are actually going to be selecting things, create an empty array to use
-- 
cgit v1.2.3


From 4dc91a5c7ec5ce2924357113861314ae14c2c978 Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Thu, 28 Jun 2012 10:00:54 -0700
Subject: clean up

Signed-off-by: Jonathan Duran <jduran@motorola.com>
---
 .../Timeline/TimelinePanel.reel/TimelinePanel.js   | 61 +---------------------
 1 file changed, 1 insertion(+), 60 deletions(-)

(limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')

diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 3d31a50b..b0ab3b19 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -1211,63 +1211,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
         		j = 0,
         		arrLayersLength = this.arrLayers.length,
         		arrSelectedIndexesLength = arrSelectedIndexes.length,
-        		currentLayersSelectedLength = this.currentLayersSelected.length,
-        		boolContinue = false,
         		arrSelectedLayers = false,
         		arrCurrentElementsSelected = [];
-            var matchedValues = 0;
-
-        	/*
-            if (arrSelectedIndexesLength !== 0) {
-	            for(i=0;i<arrSelectedIndexesLength;i++){
-	                for(j=0;j<currentLayersSelectedLength;j++){
-	
-	                    if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
-	                        matchedValues+=1;
-	                    }
-	                }
-	            }
-	
-	            if(matchedValues === arrSelectedIndexesLength){
-	                return;
-	            }
-            } 
-
-                    if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayersSelected[j]]){
-                        matchedValues+=1;
-                    }
-                }
-            }
-
-
-        	 // TODO: this should probably check to see if it actually needs to run.
-
-        	        		console.log(arrSelectedIndexes);
-        		console.log(this.currentLayersSelected);
-        	// Compare arrSelectedIndexes with this.currentLayersSelected
-        	// If the items are the same, we do not need to do anything.
-        	if (arrSelectedIndexesLength !== currentLayersSelectedLength) {
-        		// Different length in the arrays, we definitely need to continue.
-        		console.log('diferent length')
-        		boolContinue = true;
-        	} else {
-        		// Check each selected index and see if it's in this.currentLayersSelected
-        		// If we find one that isn't, we need to continue
-
-        		for (i = 0; i < arrSelectedIndexesLength; i++) {
-        			console.log('checking for ', arrSelectedIndexes[i]);
-					if (this.currentLayersSelected.indexOf(arrSelectedIndexes[i]) === -1) {
-						// Ooops, one of them was not found.
-						boolContinue = true;
-					}
-        		}
-        	}
-        	if (boolContinue === false) {
-        		console.log('exiting')
-        		return;
-        	}
-        	*/
-        	
 
             // Deselect selected layers if they're not in arrSelectedIndexes.
             for (i = 0; i < arrLayersLength; i++) {
@@ -1278,7 +1223,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
 	            		
 	            		// Check to see if this layer, that we're deselecting, has
 	            		// any selected keyframes associated with it.  If it does, deselect them.
-	            		for (var j = 0; j < this.selectedTweens.length; j++) {
+	            		for (j = 0; j < this.selectedTweens.length; j++) {
 	            			var currentStageElement;
 	            			if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") {
 	            				currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement; 
@@ -1296,10 +1241,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
             if (this.currentLayersSelected !== false) {
             	this.currentLayersSelected = false;
             }
-
-            // Deselect tweens
-            //this.deselectTweens();
-
             
             // If we are actually going to be selecting things, create an empty array to use
             if (arrSelectedIndexesLength > 0) {
-- 
cgit v1.2.3