diff options
author | Jon Reid | 2012-06-26 14:56:58 -0700 |
---|---|---|
committer | Jon Reid | 2012-06-26 14:56:58 -0700 |
commit | ab9d14780eed98f39786fae4518e69861b34bad7 (patch) | |
tree | 5e3a0a8459f078670fa7e57a017ed9c2e8c200eb /js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |
parent | 9aa987003f0c7866e66aabcc7d9cc2b9da8ed91c (diff) | |
download | ninja-ab9d14780eed98f39786fae4518e69861b34bad7.tar.gz |
Timeline: Bug fix: Keyboard shortcut now works for adding keyframes,
including splitting tweens.
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index d4eabbf5..297423dd 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -743,6 +743,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
743 | 743 | ||
744 | handleNewTween:{ | 744 | handleNewTween:{ |
745 | value:function (ev) { | 745 | value:function (ev) { |
746 | |||
746 | if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) { | 747 | if (ev.offsetX > this.tweens[this.tweens.length - 1].tweenData.keyFramePosition) { |
747 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 748 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
748 | this.application.ninja.timeline.selectLayer(selectedIndex, false); | 749 | this.application.ninja.timeline.selectLayer(selectedIndex, false); |
@@ -750,10 +751,13 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
750 | } else { | 751 | } else { |
751 | // We will be splitting a tween. Get the x-coordinate of the mouse click within the target element. | 752 | // 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. | 753 | // 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), | 754 | if (typeof(ev.currentTarget) === "undefined") { |
754 | position = event.pageX - targetElementOffset; | 755 | this.splitTweenAt(ev.offsetX); |
755 | 756 | } else { | |
756 | this.splitTweenAt(position-18); | 757 | var targetElementOffset = this.findXOffset(ev.currentTarget), |
758 | position = event.pageX - targetElementOffset; | ||
759 | this.splitTweenAt(position-18); | ||
760 | } | ||
757 | } | 761 | } |
758 | } | 762 | } |
759 | }, | 763 | }, |
@@ -762,6 +766,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
762 | value:function (obj) { | 766 | value:function (obj) { |
763 | // Here's an easy function that adds up offsets and scrolls and returns the page x value of an element | 767 | // Here's an easy function that adds up offsets and scrolls and returns the page x value of an element |
764 | var curleft = 0; | 768 | var curleft = 0; |
769 | if (typeof(obj) === "undefined") { | ||
770 | //debugger; | ||
771 | } | ||
765 | if (obj.offsetParent) { | 772 | if (obj.offsetParent) { |
766 | do { | 773 | do { |
767 | curleft += (obj.offsetLeft - obj.scrollLeft); | 774 | curleft += (obj.offsetLeft - obj.scrollLeft); |