aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
diff options
context:
space:
mode:
authorKruti Shah2012-07-03 10:09:45 -0700
committerKruti Shah2012-07-03 10:09:45 -0700
commitb35edd96135bd8c2b500ffee08474bacd17c25ac (patch)
treea043f9a730ae204bfe0922bcd46a747f78991d59 /js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
parentbf5e6d6febf0c15a00e7694d7fa2c85b0cf567fe (diff)
parent0d7918cb127f06adab5515edde72dccc137473f5 (diff)
downloadninja-b35edd96135bd8c2b500ffee08474bacd17c25ac.tar.gz
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Conflicts: js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js97
1 files changed, 26 insertions, 71 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index e6da9199..7deaf0d1 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -1214,58 +1214,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1214 arrSelectedLayers = false, 1214 arrSelectedLayers = false,
1215 arrCurrentElementsSelected = []; 1215 arrCurrentElementsSelected = [];
1216 1216
1217 /*
1218 if (arrSelectedIndexesLength !== 0) {
1219 for(i=0;i<arrSelectedIndexesLength;i++){
1220 for(j=0;j<currentLayersSelectedLength;j++){
1221
1222 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
1223 matchedValues+=1;
1224 }
1225 }
1226 }
1227
1228 if(matchedValues === arrSelectedIndexesLength){
1229 return;
1230 }
1231 }
1232
1233 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayersSelected[j]]){
1234 matchedValues+=1;
1235 }
1236 }
1237 }
1238
1239
1240 // TODO: this should probably check to see if it actually needs to run.
1241
1242 console.log(arrSelectedIndexes);
1243 console.log(this.currentLayersSelected);
1244 // Compare arrSelectedIndexes with this.currentLayersSelected
1245 // If the items are the same, we do not need to do anything.
1246 if (arrSelectedIndexesLength !== currentLayersSelectedLength) {
1247 // Different length in the arrays, we definitely need to continue.
1248 console.log('diferent length')
1249 boolContinue = true;
1250 } else {
1251 // Check each selected index and see if it's in this.currentLayersSelected
1252 // If we find one that isn't, we need to continue
1253
1254 for (i = 0; i < arrSelectedIndexesLength; i++) {
1255 console.log('checking for ', arrSelectedIndexes[i]);
1256 if (this.currentLayersSelected.indexOf(arrSelectedIndexes[i]) === -1) {
1257 // Ooops, one of them was not found.
1258 boolContinue = true;
1259 }
1260 }
1261 }
1262 if (boolContinue === false) {
1263 console.log('exiting')
1264 return;
1265 }
1266 */
1267
1268
1269 // Deselect selected layers if they're not in arrSelectedIndexes. 1217 // Deselect selected layers if they're not in arrSelectedIndexes.
1270 for (i = 0; i < arrLayersLength; i++) { 1218 for (i = 0; i < arrLayersLength; i++) {
1271 if (this.arrLayers[i].layerData.isSelected === true) { 1219 if (this.arrLayers[i].layerData.isSelected === true) {
@@ -1275,7 +1223,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1275 1223
1276 // Check to see if this layer, that we're deselecting, has 1224 // Check to see if this layer, that we're deselecting, has
1277 // any selected keyframes associated with it. If it does, deselect them. 1225 // any selected keyframes associated with it. If it does, deselect them.
1278 for (var j = 0; j < this.selectedTweens.length; j++) { 1226 for (j = 0; j < this.selectedTweens.length; j++) {
1279 var currentStageElement; 1227 var currentStageElement;
1280 if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") { 1228 if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") {
1281 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement; 1229 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement;
@@ -1293,10 +1241,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1293 if (this.currentLayersSelected !== false) { 1241 if (this.currentLayersSelected !== false) {
1294 this.currentLayersSelected = false; 1242 this.currentLayersSelected = false;
1295 } 1243 }
1296
1297 // Deselect tweens
1298 //this.deselectTweens();
1299
1300 1244
1301 // If we are actually going to be selecting things, create an empty array to use 1245 // If we are actually going to be selecting things, create an empty array to use
1302 if (arrSelectedIndexesLength > 0) { 1246 if (arrSelectedIndexesLength > 0) {
@@ -1424,9 +1368,23 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1424 arrLayersLength = arrLayers.length, 1368 arrLayersLength = arrLayers.length,
1425 targetIndex = 0, 1369 targetIndex = 0,
1426 isAlreadySelected = false, 1370 isAlreadySelected = false,
1427 indexAlreadySelected = 0, 1371 indexAlreadySelected = -5,
1428 indexLastClicked = 0; 1372 indexLastClicked = 0,
1373 ua = navigator.userAgent.toLowerCase(),
1374 boolCommandControlKeyIsPressed = false;
1375
1376 // Check to see if either the Command key (macs) or Control key (windows) is being pressed
1377 if (ua.indexOf("mac") > -1) {
1378 if (event.metaKey === true) {
1379 boolCommandControlKeyIsPressed = true;
1380 }
1381 } else {
1382 if (this._isControlPressed === true) {
1383 boolCommandControlKeyIsPressed = true;
1384 }
1385 }
1429 1386
1387
1430 // Did the mousedown event originate within a layer? 1388 // Did the mousedown event originate within a layer?
1431 if (ptrParent === false) { 1389 if (ptrParent === false) {
1432 // No it did not. Do nothing. 1390 // No it did not. Do nothing.
@@ -1443,17 +1401,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1443 1401
1444 // Did we just click on a layer that's already selected? 1402 // Did we just click on a layer that's already selected?
1445 if (this.currentLayersSelected !== false) { 1403 if (this.currentLayersSelected !== false) {
1446 indexAlreadySelected = this.currentLayersSelected.indexOf(targetIndex); 1404 for (i = 0; i < this.currentLayersSelected.length; i++) {
1405 if (this.currentLayersSelected[i] === targetIndex) {
1406 indexAlreadySelected = i;
1407 }
1408 }
1447 } 1409 }
1448 if (indexAlreadySelected > -1) { 1410 if (indexAlreadySelected > -1) {
1449 isAlreadySelected = true; 1411 isAlreadySelected = true;
1450 } 1412 }
1451
1452 /*
1453 if (targetIndex > -1) {
1454 indexLastClicked = targetIndex;
1455 }
1456 */
1457 1413
1458 // Now, do the selection based on all of that information. 1414 // Now, do the selection based on all of that information.
1459 if (this.currentLayersSelected.length === 0) { 1415 if (this.currentLayersSelected.length === 0) {
@@ -1462,13 +1418,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1462 } else { 1418 } else {
1463 // Something is already selected. What do do depends on whether 1419 // Something is already selected. What do do depends on whether
1464 // or not other keys are pressed. 1420 // or not other keys are pressed.
1465 if (this._isControlPressed === true) { 1421 if (boolCommandControlKeyIsPressed === true) {
1466 // Control key is being pressed, so we need to 1422 // Control or Command key is being pressed, so we need to
1467 // either add the current layer to selectedLayers 1423 // either add the current layer to selectedLayers
1468 // or remove it if it's already there. 1424 // or remove it if it's already there.
1469 if (this.currentLayersSelected === false) { 1425 if (this.currentLayersSelected === false) {
1470 this.currentLayersSelected = []; 1426 this.currentLayersSelected = [];
1471 //this.currentLayerSelected = false;
1472 } 1427 }
1473 if (isAlreadySelected === false) { 1428 if (isAlreadySelected === false) {
1474 this.currentLayersSelected.push(targetIndex); 1429 this.currentLayersSelected.push(targetIndex);
@@ -1500,9 +1455,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1500 this.currentLayersSelected = [targetIndex]; 1455 this.currentLayersSelected = [targetIndex];
1501 this.lastLayerClicked = targetIndex; 1456 this.lastLayerClicked = targetIndex;
1502 } 1457 }
1503
1504 } 1458 }
1505 //this._captureSelection = true;
1506 this.selectLayers(this.currentLayersSelected); 1459 this.selectLayers(this.currentLayersSelected);
1507 this.updateStageSelection(); 1460 this.updateStageSelection();
1508 } 1461 }
@@ -1523,9 +1476,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1523 // Control key has been pressed 1476 // Control key has been pressed
1524 this._isControlPressed = true; 1477 this._isControlPressed = true;
1525 } 1478 }
1479 /*
1526 if (event.metaKey === true) { 1480 if (event.metaKey === true) {
1527 this._isControlPressed = true; 1481 this._isControlPressed = true;
1528 } 1482 }
1483 */
1529 }