diff options
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index e294a69e..edca4306 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -435,6 +435,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
435 | this.init(); | 435 | this.init(); |
436 | this.ninjaStylesContoller = this.application.ninja.stylesController; | 436 | this.ninjaStylesContoller = this.application.ninja.stylesController; |
437 | this.element.addEventListener("click", this, false); | 437 | this.element.addEventListener("click", this, false); |
438 | this.eventManager.addEventListener("tlZoomSlider", this, false); | ||
438 | } | 439 | } |
439 | }, | 440 | }, |
440 | 441 | ||
@@ -467,6 +468,46 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
467 | } | 468 | } |
468 | }, | 469 | }, |
469 | 470 | ||
471 | handleTlZoomSlider: { | ||
472 | value: function(event) { | ||
473 | |||
474 | var currentMilliSecPerPixel , currentMilliSec , clickPos,thingToPush; | ||
475 | var i = 0, | ||
476 | tweensLength = this.tweens.length; | ||
477 | |||
478 | for (i = 0; i < tweensLength; i++) { | ||
479 | |||
480 | if (i === 0) { | ||
481 | // Exception: 0th item does not depend on anything | ||
482 | // TODO: If 0th tween is draggable, this will need to be fixed. | ||
483 | this.tweens[i].tweenData.spanWidth=0; | ||
484 | this.tweens[i].tweenData.spanPosition=0; | ||
485 | this.tweens[i].tweenData.keyFramePosition=0; | ||
486 | this.tweens[i].tweenData.keyFrameMillisec=0; | ||
487 | |||
488 | } else { | ||
489 | var prevKeyFramePosition = this.tweens[i - 1].tweenData.keyFramePosition, | ||
490 | myObj = {}, | ||
491 | thing = {}; | ||
492 | |||
493 | currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | ||
494 | currentMilliSec = this.tweens[i].tweenData.keyFrameMillisec; | ||
495 | clickPos = currentMilliSec / currentMilliSecPerPixel; | ||
496 | |||
497 | for (thing in this.tweens[i].tweenData) { | ||
498 | myObj[thing] = this.tweens[i].tweenData[thing]; | ||
499 | } | ||
500 | myObj.spanWidth = clickPos - prevKeyFramePosition; | ||
501 | myObj.keyFramePosition = clickPos; | ||
502 | myObj.spanPosition = clickPos - (clickPos - prevKeyFramePosition); | ||
503 | |||
504 | this.tweens[i].tweenData = myObj; | ||
505 | } | ||
506 | |||
507 | |||
508 | } | ||
509 | } | ||
510 | }, | ||
470 | handleClick:{ | 511 | handleClick:{ |
471 | value:function (ev) { | 512 | value:function (ev) { |
472 | // TEMP - if the SHIFT key is down, add a new keyframe or split an existing span | 513 | // TEMP - if the SHIFT key is down, add a new keyframe or split an existing span |
@@ -682,6 +723,18 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
682 | } | 723 | } |
683 | } | 724 | } |
684 | }, | 725 | }, |
726 | getTweenIndexById: { | ||
727 | value: function(intID) { | ||
728 | var i = 0, | ||
729 | arrTweensLength = this.tweens.length; | ||
730 | for (i = 0; i < arrTweensLength; i++) { | ||
731 | if (this.tweens[i].tweenData.tweenID === intID) { | ||
732 | returnVal = i; | ||
733 | } | ||
734 | } | ||
735 | return returnVal; | ||
736 | } | ||
737 | }, | ||
685 | /* Begin: Logging routines */ | 738 | /* Begin: Logging routines */ |
686 | _boolDebug: { | 739 | _boolDebug: { |
687 | enumerable: false, | 740 | enumerable: false, |