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.js34
1 files changed, 27 insertions, 7 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 98989022..014d3f34 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -72,6 +72,19 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
72 this.trackData.isVisible = value; 72 this.trackData.isVisible = value;
73 } 73 }
74 }, 74 },
75
76 _stageElement: {
77 value: null
78 },
79 stageElement: {
80 get: function() {
81 return this._stageElement;
82 },
83 set: function(newVal) {
84 this._stageElement = newVal;
85 this.trackData.stageElement = newVal;
86 }
87 },
75 88
76 // Are the various collapsers collapsed or not 89 // Are the various collapsers collapsed or not
77 _isMainCollapsed:{ 90 _isMainCollapsed:{
@@ -484,6 +497,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
484 this.isStyleCollapsed = this.trackData.isStyleCollapsed; 497 this.isStyleCollapsed = this.trackData.isStyleCollapsed;
485 this.trackPosition = this.trackData.trackPosition; 498 this.trackPosition = this.trackData.trackPosition;
486 this.isVisible = this.trackData.isVisible; 499 this.isVisible = this.trackData.isVisible;
500 this.stageElement = this.trackData.stageElement;
487 this.trackEditorProperty = "master"; 501 this.trackEditorProperty = "master";
488 this.needsDraw = true; 502 this.needsDraw = true;
489 } 503 }
@@ -692,6 +706,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
692 this.application.ninja.timeline.updateTimeText(currentMillisec); 706 this.application.ninja.timeline.updateTimeText(currentMillisec);
693 707
694 if (ev.shiftKey) { 708 if (ev.shiftKey) {
709 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
710 this.application.ninja.timeline.selectLayer(selectedIndex, true);
695 if (this.tweens.length < 1) { 711 if (this.tweens.length < 1) {
696 this.insertTween(0); 712 this.insertTween(0);
697 this.addAnimationRuleToElement(ev); 713 this.addAnimationRuleToElement(ev);
@@ -729,6 +745,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
729 745
730 handleNewTween:{ 746 handleNewTween:{
731 value:function (ev) { 747 value:function (ev) {
748
732 if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) { 749 if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) {
733 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); 750 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
734 this.application.ninja.timeline.selectLayer(selectedIndex, false); 751 this.application.ninja.timeline.selectLayer(selectedIndex, false);
@@ -736,10 +753,13 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
736 } else { 753 } else {
737 // We will be splitting a tween. Get the x-coordinate of the mouse click within the target element. 754 // We will be splitting a tween. Get the x-coordinate of the mouse click within the target element.
738 // You'd think you could use the event.x info for that, right? NO. We must use page values, calculating offsets and scrolling. 755 // You'd think you could use the event.x info for that, right? NO. We must use page values, calculating offsets and scrolling.
739 var targetElementOffset = this.findXOffset(ev.currentTarget), 756 if (typeof(ev.currentTarget) === "undefined") {
740 position = event.pageX - targetElementOffset; 757 this.splitTweenAt(ev.offsetX);
741 758 } else {
742 this.splitTweenAt(position-18); 759 var targetElementOffset = this.findXOffset(ev.currentTarget),
760 position = event.pageX - targetElementOffset;
761 this.splitTweenAt(position-18);
762 }
743 } 763 }
744 } 764 }
745 }, 765 },
@@ -748,6 +768,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
748 value:function (obj) { 768 value:function (obj) {
749 // Here's an easy function that adds up offsets and scrolls and returns the page x value of an element 769 // Here's an easy function that adds up offsets and scrolls and returns the page x value of an element
750 var curleft = 0; 770 var curleft = 0;
771 if (typeof(obj) === "undefined") {
772 //debugger;
773 }
751 if (obj.offsetParent) { 774 if (obj.offsetParent) {
752 do { 775 do {
753 curleft += (obj.offsetLeft - obj.scrollLeft); 776 curleft += (obj.offsetLeft - obj.scrollLeft);
@@ -760,9 +783,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
760 783
761 insertTween:{ 784 insertTween:{
762 value:function (clickPos) { 785 value:function (clickPos) {
763 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
764 this.application.ninja.timeline.selectLayer(selectedIndex, true);
765
766 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 786 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
767 var currentMillisec = currentMillisecPerPixel * clickPos; 787 var currentMillisec = currentMillisecPerPixel * clickPos;
768 this.trackDuration = currentMillisec; 788 this.trackDuration = currentMillisec;