aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-05-18 16:07:02 -0700
committerJon Reid2012-05-18 16:07:02 -0700
commit119fec85a659cc470377032abab8c6e60fa55b1b (patch)
tree606e11015f699b1342a8d3fc4c716824d532600b /js
parente7286bcbd82c944ffe9705d87ff23b9ea29ea7e5 (diff)
downloadninja-119fec85a659cc470377032abab8c6e60fa55b1b.tar.gz
Timeline: Code cleanup
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js65
1 files changed, 16 insertions, 49 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 43ffaab2..185211ae 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -376,6 +376,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
376 _ignoreSelectionChanges: { 376 _ignoreSelectionChanges: {
377 value: false 377 value: false
378 }, 378 },
379 // is the control key currently being pressed (used for multiselect)
380 _isControlPressed: {
381 value: false
382 },
383
384 // is the shift key currently being pressed (used for multiselect)
385 _isShiftPressed: {
386 value: false
387 },
379 /* === END: Models === */ 388 /* === END: Models === */
380 389
381 /* === BEGIN: Draw cycle === */ 390 /* === BEGIN: Draw cycle === */
@@ -447,15 +456,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
447 456
448 } 457 }
449 }, 458 },
450 // is the control key currently being pressed (used for multiselect)
451 _isControlPressed: {
452 value: false
453 },
454 459
455 // is the shift key currently being pressed (used for multiselect)
456 _isShiftPressed: {
457 value: false
458 },
459 /* === END: Draw cycle === */ 460 /* === END: Draw cycle === */
460 /* === BEGIN: Controllers === */ 461 /* === BEGIN: Controllers === */
461 // Create an empty layer template object with minimal defaults and return it for use 462 // Create an empty layer template object with minimal defaults and return it for use
@@ -571,12 +572,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
571 // Bind all document-specific events (pass in true to unbind) 572 // Bind all document-specific events (pass in true to unbind)
572 _bindDocumentEvents : { 573 _bindDocumentEvents : {
573 value: function(boolUnbind) { 574 value: function(boolUnbind) {
574 var arrEvents = [ "stageElement", 575 /*
576 var arrEvents = [ "stageElement",
575 "deleteLayer", 577 "deleteLayer",
576 "elementAdded", 578 "elementAdded",
577 "elementsRemoved", 579 "elementsRemoved",
578 "elementReplaced", 580 "elementReplaced",
579 "selectionChange"], 581 "selectionChange"],
582 */
583 var arrEvents = ["elementAdded",
584 "elementsRemoved",
585 "selectionChange"],
580 i, 586 i,
581 arrEventsLength = arrEvents.length; 587 arrEventsLength = arrEvents.length;
582 588
@@ -623,7 +629,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
623 document.addEventListener("click", this.handleDocumentClick.bind(this), false); 629 document.addEventListener("click", this.handleDocumentClick.bind(this), false);
624 630
625 // Add some event handlers 631 // Add some event handlers
626 this.timeline_leftpane.addEventListener("mousedown", this.timelineLeftPanelMousedown.bind(this), false); 632 this.timeline_leftpane.addEventListener("click", this.timelineLeftPanelMousedown.bind(this), false);
627 //this.timeline_leftpane.addEventListener("click", this.timelineLeftPanelMousedown.bind(this), false); 633 //this.timeline_leftpane.addEventListener("click", this.timelineLeftPanelMousedown.bind(this), false);
628 //this.timeline_leftpane.addEventListener("mouseup", this.timelineLeftPaneMouseup.bind(this), false); 634 //this.timeline_leftpane.addEventListener("mouseup", this.timelineLeftPaneMouseup.bind(this), false);
629 this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); 635 this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false);
@@ -1352,45 +1358,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1352 } 1358 }
1353 }, 1359 },
1354 1360
1355 createLayerHashTable:{
1356 value:function (key, value) {
1357 var hashLayerObject;
1358 hashLayerObject = Object.create(Object.prototype, {
1359 counter:{
1360 value:0,
1361 writable:true
1362 },
1363
1364 setItem:{
1365 value:function (key, value, index) {
1366 if (hashLayerObject[key] === undefined) {
1367 hashLayerObject[key] = {};
1368 }
1369 if (hashLayerObject[key][index] !== undefined) {
1370
1371
1372 for (this.counter = index; hashLayerObject[key][this.counter]; this.counter++) {
1373 }
1374
1375 for (; this.counter !== index; this.counter--) {
1376 hashLayerObject[key][this.counter] = hashLayerObject[key][this.counter - 1];
1377 }
1378 }
1379 hashLayerObject[key][index] = value;
1380 this.counter = 0;
1381 }
1382 },
1383
1384 getItem:{
1385 value:function (key) {
1386 return hashLayerObject[key];
1387 }
1388 }
1389 });
1390 return hashLayerObject;
1391 }
1392 },
1393
1394 selectLayer:{ 1361 selectLayer:{
1395 value:function (layerIndex, userSelection) { 1362 value:function (layerIndex, userSelection) {
1396 console.log("=----> Please update this component to use TimelinePanel.selectLayers. See this message for syntax. <----="); 1363 console.log("=----> Please update this component to use TimelinePanel.selectLayers. See this message for syntax. <----=");