diff options
author | Jonathan Duran | 2012-06-26 16:56:17 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-06-26 16:56:17 -0700 |
commit | 3b1bc2e5b3060b74853d40e4ec7c116faaa462c6 (patch) | |
tree | ade892c3043f89238ac6ff30b8d7a88459d9ac8d /js/panels/Timeline/TimelineTrack.reel | |
parent | bdeedb6c37212b4991b5f492ce665361997dd8e6 (diff) | |
parent | 45a5deac8ee1e38a6835275230f947b6aa8fb62a (diff) | |
download | ninja-3b1bc2e5b3060b74853d40e4ec7c116faaa462c6.tar.gz |
Merge branch 'refs/heads/timeline-local' into TimelineUber
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index d4eabbf5..014d3f34 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -706,6 +706,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
706 | this.application.ninja.timeline.updateTimeText(currentMillisec); | 706 | this.application.ninja.timeline.updateTimeText(currentMillisec); |
707 | 707 | ||
708 | 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); | ||
709 | if (this.tweens.length < 1) { | 711 | if (this.tweens.length < 1) { |
710 | this.insertTween(0); | 712 | this.insertTween(0); |
711 | this.addAnimationRuleToElement(ev); | 713 | this.addAnimationRuleToElement(ev); |
@@ -743,6 +745,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
743 | 745 | ||
744 | handleNewTween:{ | 746 | handleNewTween:{ |
745 | value:function (ev) { | 747 | value:function (ev) { |
748 | |||
746 | if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) { | 749 | if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) { |
747 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 750 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
748 | this.application.ninja.timeline.selectLayer(selectedIndex, false); | 751 | this.application.ninja.timeline.selectLayer(selectedIndex, false); |
@@ -750,10 +753,13 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
750 | } else { | 753 | } else { |
751 | // 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. |
752 | // 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. |
753 | var targetElementOffset = this.findXOffset(ev.currentTarget), | 756 | if (typeof(ev.currentTarget) === "undefined") { |
754 | position = event.pageX - targetElementOffset; | 757 | this.splitTweenAt(ev.offsetX); |
755 | 758 | } else { | |
756 | this.splitTweenAt(position-18); | 759 | var targetElementOffset = this.findXOffset(ev.currentTarget), |
760 | position = event.pageX - targetElementOffset; | ||
761 | this.splitTweenAt(position-18); | ||
762 | } | ||
757 | } | 763 | } |
758 | } | 764 | } |
759 | }, | 765 | }, |
@@ -762,6 +768,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
762 | value:function (obj) { | 768 | value:function (obj) { |
763 | // 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 |
764 | var curleft = 0; | 770 | var curleft = 0; |
771 | if (typeof(obj) === "undefined") { | ||
772 | //debugger; | ||
773 | } | ||
765 | if (obj.offsetParent) { | 774 | if (obj.offsetParent) { |
766 | do { | 775 | do { |
767 | curleft += (obj.offsetLeft - obj.scrollLeft); | 776 | curleft += (obj.offsetLeft - obj.scrollLeft); |
@@ -774,9 +783,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
774 | 783 | ||
775 | insertTween:{ | 784 | insertTween:{ |
776 | value:function (clickPos) { | 785 | value:function (clickPos) { |
777 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | ||
778 | this.application.ninja.timeline.selectLayer(selectedIndex, true); | ||
779 | |||
780 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | 786 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); |
781 | var currentMillisec = currentMillisecPerPixel * clickPos; | 787 | var currentMillisec = currentMillisecPerPixel * clickPos; |
782 | this.trackDuration = currentMillisec; | 788 | this.trackDuration = currentMillisec; |