aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelineTrack.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 35440cc4..1731213b 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -617,6 +617,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
617 this.application.ninja.timeline.selectLayer(selectedIndex, false); 617 this.application.ninja.timeline.selectLayer(selectedIndex, false);
618 this.insertTween(ev.offsetX); 618 this.insertTween(ev.offsetX);
619 } else { 619 } else {
620 console.log(ev.target);
620 this.splitTween(ev); 621 this.splitTween(ev);
621 } 622 }
622 } 623 }
@@ -671,7 +672,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
671 672
672 splitTween:{ 673 splitTween:{
673 value:function (ev) { 674 value:function (ev) {
674 console.log("Splitting an existing span with a new keyframe.");
675 var clickPos = ev.target.parentElement.offsetLeft + ev.offsetX; 675 var clickPos = ev.target.parentElement.offsetLeft + ev.offsetX;
676 var i; 676 var i;
677 var tweensLength = this.tweens.length-1; 677 var tweensLength = this.tweens.length-1;
@@ -680,14 +680,17 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
680 prevTween = this.tweens[i].tweenData.keyFramePosition; 680 prevTween = this.tweens[i].tweenData.keyFramePosition;
681 nextTween = this.tweens[i+1].tweenData.keyFramePosition; 681 nextTween = this.tweens[i+1].tweenData.keyFramePosition;
682 if(clickPos > prevTween && clickPos < nextTween){ 682 if(clickPos > prevTween && clickPos < nextTween){
683 console.log(clickPos + " found on tween: "+ this.tweens[i+1].tweenData.tweenID); 683 //console.log(clickPos + " found on tween: "+ this.tweens[i+1].tweenData.tweenID);
684 splitTweenIndex = this.tweens[i+1].tweenData.tweenID; 684 splitTweenIndex = this.tweens[i+1].tweenData.tweenID;
685 this.tweens[i+1].tweenData.spanWidth = this.tweens[i+1].tweenData.keyFramePosition - clickPos; 685 this.tweens[i+1].tweenData.spanWidth = this.tweens[i+1].tweenData.keyFramePosition - clickPos;
686 this.tweens[i+1].tweenData.spanPosition = ev.target.parentElement.offsetLeft + ev.offsetX; 686 this.tweens[i+1].tweenData.spanPosition = ev.target.parentElement.offsetLeft + ev.offsetX;
687 ev.target.style.width = this.tweens[i+1].tweenData.spanWidth + "px"; 687 if (ev.target.className != "tween-span") {
688 ev.target.parentElement.style.left = clickPos + "px"; 688 // don't set styles on timeline track if event is coming from the track
689 ev.target.parentElement.children[1].style.left = (this.tweens[i+1].tweenData.spanWidth - 3) + "px"; 689 } else {
690 690 ev.target.style.width = this.tweens[i + 1].tweenData.spanWidth + "px";
691 ev.target.parentElement.style.left = clickPos + "px";
692 ev.target.parentElement.children[1].style.left = (this.tweens[i + 1].tweenData.spanWidth - 3) + "px";
693 }
691 var newTweenToInsert = {}; 694 var newTweenToInsert = {};
692 newTweenToInsert.tweenData = {}; 695 newTweenToInsert.tweenData = {};
693 newTweenToInsert.tweenData.spanWidth = clickPos - prevTween; 696 newTweenToInsert.tweenData.spanWidth = clickPos - prevTween;
@@ -701,9 +704,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
701 newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; 704 newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth;
702 newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; 705 newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight;
703 this.tweens.splice(splitTweenIndex, 0, newTweenToInsert); 706 this.tweens.splice(splitTweenIndex, 0, newTweenToInsert);
707 break;
704 } 708 }
705 } 709 }
706
707 this.application.ninja.documentController.activeDocument.needsSave = true; 710 this.application.ninja.documentController.activeDocument.needsSave = true;
708 } 711 }
709 }, 712 },