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.js100
1 files changed, 26 insertions, 74 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 3d31a50b..7deaf0d1 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, {
1211 j = 0, 1211 j = 0,
1212 arrLayersLength = this.arrLayers.length, 1212 arrLayersLength = this.arrLayers.length,
1213 arrSelectedIndexesLength = arrSelectedIndexes.length, 1213 arrSelectedIndexesLength = arrSelectedIndexes.length,
1214 currentLayersSelectedLength = this.currentLayersSelected.length,
1215 boolContinue = false,
1216 arrSelectedLayers = false, 1214 arrSelectedLayers = false,
1217 arrCurrentElementsSelected = []; 1215 arrCurrentElementsSelected = [];
1218 var matchedValues = 0;
1219
1220 /*
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 }
1235
1236 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayersSelected[j]]){
1237 matchedValues+=1;
1238 }
1239 }
1240 }
1241
1242
1243 // TODO: this should probably check to see if it actually needs to run.
1244
1245 console.log(arrSelectedIndexes);
1246 console.log(this.currentLayersSelected);
1247 // Compare arrSelectedIndexes with this.currentLayersSelected
1248 // If the items are the same, we do not need to do anything.
1249 if (arrSelectedIndexesLength !== currentLayersSelectedLength) {
1250 // Different length in the arrays, we definitely need to continue.
1251 console.log('diferent length')
1252 boolContinue = true;
1253 } else {
1254 // Check each selected index and see if it's in this.currentLayersSelected
1255 // If we find one that isn't, we need to continue
1256
1257 for (i = 0; i < arrSelectedIndexesLength; i++) {
1258 console.log('checking for ', arrSelectedIndexes[i]);
1259 if (this.currentLayersSelected.indexOf(arrSelectedIndexes[i]) === -1) {
1260 // Ooops, one of them was not found.
1261 boolContinue = true;
1262 }
1263 }
1264 }
1265 if (boolContinue === false) {
1266 console.log('exiting')
1267 return;
1268 }
1269 */
1270
1271 1216
1272 // Deselect selected layers if they're not in arrSelectedIndexes. 1217 // Deselect selected layers if they're not in arrSelectedIndexes.
1273 for (i = 0; i < arrLayersLength; i++) { 1218 for (i = 0; i < arrLayersLength; i++) {
@@ -1278,7 +1223,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1278 1223
1279 // Check to see if this layer, that we're deselecting, has 1224 // Check to see if this layer, that we're deselecting, has
1280 // any selected keyframes associated with it. If it does, deselect them. 1225 // any selected keyframes associated with it. If it does, deselect them.
1281 for (var j = 0; j < this.selectedTweens.length; j++) { 1226 for (j = 0; j < this.selectedTweens.length; j++) {
1282 var currentStageElement; 1227 var currentStageElement;
1283 if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") { 1228 if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") {
1284 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement; 1229 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement;
@@ -1296,10 +1241,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1296 if (this.currentLayersSelected !== false) { 1241 if (this.currentLayersSelected !== false) {
1297 this.currentLayersSelected = false; 1242 this.currentLayersSelected = false;
1298 } 1243 }
1299
1300 // Deselect tweens
1301 //this.deselectTweens();
1302
1303 1244
1304 // 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
1305 if (arrSelectedIndexesLength > 0) { 1246 if (arrSelectedIndexesLength > 0) {
@@ -1427,9 +1368,23 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1427 arrLayersLength = arrLayers.length, 1368 arrLayersLength = arrLayers.length,
1428 targetIndex = 0, 1369 targetIndex = 0,
1429 isAlreadySelected = false, 1370 isAlreadySelected = false,
1430 indexAlreadySelected = 0, 1371 indexAlreadySelected = -5,
1431 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 }
1432 1386
1387
1433 // Did the mousedown event originate within a layer? 1388 // Did the mousedown event originate within a layer?
1434 if (ptrParent === false) { 1389 if (ptrParent === false) {
1435 // No it did not. Do nothing. 1390 // No it did not. Do nothing.
@@ -1446,17 +1401,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1446 1401
1447 // Did we just click on a layer that's already selected? 1402 // Did we just click on a layer that's already selected?
1448 if (this.currentLayersSelected !== false) { 1403 if (this.currentLayersSelected !== false) {
1449 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 }
1450 } 1409 }
1451 if (indexAlreadySelected > -1) { 1410 if (indexAlreadySelected > -1) {
1452 isAlreadySelected = true; 1411 isAlreadySelected = true;
1453 } 1412 }
1454
1455 /*
1456 if (targetIndex > -1) {
1457 indexLastClicked = targetIndex;
1458 }
1459 */
1460 1413
1461 // Now, do the selection based on all of that information. 1414 // Now, do the selection based on all of that information.
1462 if (this.currentLayersSelected.length === 0) { 1415 if (this.currentLayersSelected.length === 0) {
@@ -1465,13 +1418,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1465 } else { 1418 } else {
1466 // Something is already selected. What do do depends on whether 1419 // Something is already selected. What do do depends on whether
1467 // or not other keys are pressed. 1420 // or not other keys are pressed.
1468 if (this._isControlPressed === true) { 1421 if (boolCommandControlKeyIsPressed === true) {
1469 // Control key is being pressed, so we need to 1422 // Control or Command key is being pressed, so we need to
1470 // either add the current layer to selectedLayers 1423 // either add the current layer to selectedLayers
1471 // or remove it if it's already there. 1424 // or remove it if it's already there.
1472 if (this.currentLayersSelected === false) { 1425 if (this.currentLayersSelected === false) {
1473 this.currentLayersSelected = []; 1426 this.currentLayersSelected = [];
1474 //this.currentLayerSelected = false;
1475 } 1427 }
1476 if (isAlreadySelected === false) { 1428 if (isAlreadySelected === false) {
1477 this.currentLayersSelected.push(targetIndex); 1429 this.currentLayersSelected.push(targetIndex);
@@ -1503,9 +1455,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1503 this.currentLayersSelected = [targetIndex]; 1455 this.currentLayersSelected = [targetIndex];
1504 this.lastLayerClicked = targetIndex; 1456 this.lastLayerClicked = targetIndex;
1505 } 1457 }
1506
1507 } 1458 }
1508 //this._captureSelection = true;
1509 this.selectLayers(this.currentLayersSelected); 1459 this.selectLayers(this.currentLayersSelected);
1510 this.updateStageSelection(); 1460 this.updateStageSelection();
1511 } 1461 }
@@ -1526,9 +1476,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1526 // Control key has been pressed 1476 // Control key has been pressed
1527 this._isControlPressed = true; 1477 this._isControlPressed = true;
1528 } 1478 }
1479 /*
1529 if (event.metaKey === true) { 1480 if (event.metaKey === true) {
1530 this._isControlPressed = true; 1481 this._isControlPressed = true;
1531 } 1482 }
1483 */