diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 229 |
1 files changed, 100 insertions, 129 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 3dc2e514..5df5775f 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -263,6 +263,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
263 | } | 263 | } |
264 | }, | 264 | }, |
265 | 265 | ||
266 | _lastInsertionIndex: { | ||
267 | value: false | ||
268 | }, | ||
269 | lastInsertionIndex: { | ||
270 | get: function() { | ||
271 | return this._lastInsertionIndex; | ||
272 | }, | ||
273 | set: function(newVal) { | ||
274 | this._lastInsertionIndex = newVal; | ||
275 | } | ||
276 | }, | ||
277 | |||
266 | _areTracksScrolling: { | 278 | _areTracksScrolling: { |
267 | value: false | 279 | value: false |
268 | }, | 280 | }, |
@@ -1235,63 +1247,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1235 | j = 0, | 1247 | j = 0, |
1236 | arrLayersLength = this.arrLayers.length, | 1248 | arrLayersLength = this.arrLayers.length, |
1237 | arrSelectedIndexesLength = arrSelectedIndexes.length, | 1249 | arrSelectedIndexesLength = arrSelectedIndexes.length, |
1238 | currentLayersSelectedLength = this.currentLayersSelected.length, | ||
1239 | boolContinue = false, | ||
1240 | arrSelectedLayers = false, | 1250 | arrSelectedLayers = false, |
1241 | arrCurrentElementsSelected = []; | 1251 | arrCurrentElementsSelected = []; |
1242 | var matchedValues = 0; | ||
1243 | |||
1244 | /* | ||
1245 | if (arrSelectedIndexesLength !== 0) { | ||
1246 | for(i=0;i<arrSelectedIndexesLength;i++){ | ||
1247 | for(j=0;j<currentLayersSelectedLength;j++){ | ||
1248 | |||
1249 | if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){ | ||
1250 | matchedValues+=1; | ||
1251 | } | ||
1252 | } | ||
1253 | } | ||
1254 | |||
1255 | if(matchedValues === arrSelectedIndexesLength){ | ||
1256 | return; | ||
1257 | } | ||
1258 | } | ||
1259 | |||
1260 | if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayersSelected[j]]){ | ||
1261 | matchedValues+=1; | ||
1262 | } | ||
1263 | } | ||
1264 | } | ||
1265 | |||
1266 | |||
1267 | // TODO: this should probably check to see if it actually needs to run. | ||
1268 | |||
1269 | console.log(arrSelectedIndexes); | ||
1270 | console.log(this.currentLayersSelected); | ||
1271 | // Compare arrSelectedIndexes with this.currentLayersSelected | ||
1272 | // If the items are the same, we do not need to do anything. | ||
1273 | if (arrSelectedIndexesLength !== currentLayersSelectedLength) { | ||
1274 | // Different length in the arrays, we definitely need to continue. | ||
1275 | console.log('diferent length') | ||
1276 | boolContinue = true; | ||
1277 | } else { | ||
1278 | // Check each selected index and see if it's in this.currentLayersSelected | ||
1279 | // If we find one that isn't, we need to continue | ||
1280 | |||
1281 | for (i = 0; i < arrSelectedIndexesLength; i++) { | ||
1282 | console.log('checking for ', arrSelectedIndexes[i]); | ||
1283 | if (this.currentLayersSelected.indexOf(arrSelectedIndexes[i]) === -1) { | ||
1284 | // Ooops, one of them was not found. | ||
1285 | boolContinue = true; | ||
1286 | } | ||
1287 | } | ||
1288 | } | ||
1289 | if (boolContinue === false) { | ||
1290 | console.log('exiting') | ||
1291 | return; | ||
1292 | } | ||
1293 | */ | ||
1294 | |||
1295 | 1252 | ||
1296 | // Deselect selected layers if they're not in arrSelectedIndexes. | 1253 | // Deselect selected layers if they're not in arrSelectedIndexes. |
1297 | for (i = 0; i < arrLayersLength; i++) { | 1254 | for (i = 0; i < arrLayersLength; i++) { |
@@ -1302,7 +1259,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1302 | 1259 | ||
1303 | // Check to see if this layer, that we're deselecting, has | 1260 | // Check to see if this layer, that we're deselecting, has |
1304 | // any selected keyframes associated with it. If it does, deselect them. | 1261 | // any selected keyframes associated with it. If it does, deselect them. |
1305 | for (var j = 0; j < this.selectedTweens.length; j++) { | 1262 | for (j = 0; j < this.selectedTweens.length; j++) { |
1306 | var currentStageElement; | 1263 | var currentStageElement; |
1307 | if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") { | 1264 | if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") { |
1308 | currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement; | 1265 | currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement; |
@@ -1320,10 +1277,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1320 | if (this.currentLayersSelected !== false) { | 1277 | if (this.currentLayersSelected !== false) { |
1321 | this.currentLayersSelected = false; | 1278 | this.currentLayersSelected = false; |
1322 | } | 1279 | } |
1323 | |||
1324 | // Deselect tweens | ||
1325 | //this.deselectTweens(); | ||
1326 | |||
1327 | 1280 | ||
1328 | // If we are actually going to be selecting things, create an empty array to use | 1281 | // If we are actually going to be selecting things, create an empty array to use |
1329 | if (arrSelectedIndexesLength > 0) { | 1282 | if (arrSelectedIndexesLength > 0) { |
@@ -1451,9 +1404,23 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1451 | arrLayersLength = arrLayers.length, | 1404 | arrLayersLength = arrLayers.length, |
1452 | targetIndex = 0, | 1405 | targetIndex = 0, |
1453 | isAlreadySelected = false, | 1406 | isAlreadySelected = false, |
1454 | indexAlreadySelected = 0, | 1407 | indexAlreadySelected = -5, |
1455 | indexLastClicked = 0; | 1408 | indexLastClicked = 0, |
1409 | ua = navigator.userAgent.toLowerCase(), | ||
1410 | boolCommandControlKeyIsPressed = false; | ||
1411 | |||
1412 | // Check to see if either the Command key (macs) or Control key (windows) is being pressed | ||
1413 | if (ua.indexOf("mac") > -1) { | ||
1414 | if (event.metaKey === true) { | ||
1415 | boolCommandControlKeyIsPressed = true; | ||
1416 | } | ||
1417 | } else { | ||
1418 | if (this._isControlPressed === true) { | ||
1419 | boolCommandControlKeyIsPressed = true; | ||
1420 | } | ||
1421 | } | ||
1456 | 1422 | ||
1423 | |||
1457 | // Did the mousedown event originate within a layer? | 1424 | // Did the mousedown event originate within a layer? |
1458 | if (ptrParent === false) { | 1425 | if (ptrParent === false) { |
1459 | // No it did not. Do nothing. | 1426 | // No it did not. Do nothing. |
@@ -1470,17 +1437,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1470 | 1437 | ||
1471 | // Did we just click on a layer that's already selected? | 1438 | // Did we just click on a layer that's already selected? |
1472 | if (this.currentLayersSelected !== false) { | 1439 | if (this.currentLayersSelected !== false) { |
1473 | indexAlreadySelected = this.currentLayersSelected.indexOf(targetIndex); | 1440 | for (i = 0; i < this.currentLayersSelected.length; i++) { |
1441 | if (this.currentLayersSelected[i] === targetIndex) { | ||
1442 | indexAlreadySelected = i; | ||
1443 | } | ||
1444 | } | ||
1474 | } | 1445 | } |
1475 | if (indexAlreadySelected > -1) { | 1446 | if (indexAlreadySelected > -1) { |
1476 | isAlreadySelected = true; | 1447 | isAlreadySelected = true; |
1477 | } | 1448 | } |
1478 | |||
1479 | /* | ||
1480 | if (targetIndex > -1) { | ||
1481 | indexLastClicked = targetIndex; | ||
1482 | } | ||
1483 | */ | ||
1484 | 1449 | ||
1485 | // Now, do the selection based on all of that information. | 1450 | // Now, do the selection based on all of that information. |
1486 | if (this.currentLayersSelected.length === 0) { | 1451 | if (this.currentLayersSelected.length === 0) { |
@@ -1489,13 +1454,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1489 | } else { | 1454 | } else { |
1490 | // Something is already selected. What do do depends on whether | 1455 | // Something is already selected. What do do depends on whether |
1491 | // or not other keys are pressed. | 1456 | // or not other keys are pressed. |
1492 | if (this._isControlPressed === true) { | 1457 | if (boolCommandControlKeyIsPressed === true) { |
1493 | // Control key is being pressed, so we need to | 1458 | // Control or Command key is being pressed, so we need to |
1494 | // either add the current layer to selectedLayers | 1459 | // either add the current layer to selectedLayers |
1495 | // or remove it if it's already there. | 1460 | // or remove it if it's already there. |
1496 | if (this.currentLayersSelected === false) { | 1461 | if (this.currentLayersSelected === false) { |
1497 | this.currentLayersSelected = []; | 1462 | this.currentLayersSelected = []; |
1498 | //this.currentLayerSelected = false; | ||
1499 | } | 1463 | } |
1500 | if (isAlreadySelected === false) { | 1464 | if (isAlreadySelected === false) { |
1501 | this.currentLayersSelected.push(targetIndex); | 1465 | this.currentLayersSelected.push(targetIndex); |
@@ -1527,9 +1491,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1527 | this.currentLayersSelected = [targetIndex]; | 1491 | this.currentLayersSelected = [targetIndex]; |
1528 | this.lastLayerClicked = targetIndex; | 1492 | this.lastLayerClicked = targetIndex; |
1529 | } | 1493 | } |
1530 |