aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js35
1 files changed, 20 insertions, 15 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index e6b773c9..3a8d1ff3 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -683,9 +683,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
683 // This needs to move to a keyboard shortcut that is TBD 683 // This needs to move to a keyboard shortcut that is TBD
684 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); 684 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
685 685
686 this.application.ninja.timeline.playheadmarker.style.left = ev.offsetX + "px"; 686 var targetElementOffset = this.findXOffset(ev.currentTarget),
687 position = (event.pageX - targetElementOffset) - 18;
688
689 this.application.ninja.timeline.playheadmarker.style.left = position + "px";
687 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 690 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
688 var currentMillisec = currentMillisecPerPixel * ev.offsetX; 691 var currentMillisec = currentMillisecPerPixel * position;
689 this.application.ninja.timeline.updateTimeText(currentMillisec); 692 this.application.ninja.timeline.updateTimeText(currentMillisec);
690 693
691 if (ev.shiftKey) { 694 if (ev.shiftKey) {
@@ -733,19 +736,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
733 } else { 736 } else {
734 // We will be splitting a tween. Get the x-coordinate of the mouse click within the target element. 737 // We will be splitting a tween. Get the x-coordinate of the mouse click within the target element.
735 // You'd think you could use the event.x info for that, right? NO. We must use page values, calculating offsets and scrolling. 738 // You'd think you could use the event.x info for that, right? NO. We must use page values, calculating offsets and scrolling.
736 739 var targetElementOffset = this.findXOffset(ev.currentTarget),
737 // Here's an easy function that adds up offsets and scrolls and returns the page x value of an element
738 var findXOffset = function(obj) {
739 var curleft = 0;
740 if (obj.offsetParent) {
741 do {
742 curleft += (obj.offsetLeft-obj.scrollLeft);
743
744 } while (obj = obj.offsetParent);
745 }
746 return curleft;
747 }
748 var targetElementOffset = findXOffset(ev.currentTarget),
749 position = event.pageX - targetElementOffset; 740 position = event.pageX - targetElementOffset;
750 741
751 this.splitTweenAt(position-18); 742 this.splitTweenAt(position-18);
@@ -753,6 +744,20 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
753 } 744 }
754 }, 745 },
755 746
747 findXOffset:{
748 value:function (obj) {
749 // Here's an easy function that adds up offsets and scrolls and returns the page x value of an element
750 var curleft = 0;
751 if (obj.offsetParent) {
752 do {
753 curleft += (obj.offsetLeft - obj.scrollLeft);
754
755 } while (obj = obj.offsetParent);
756 }
757 return curleft;
758 }
759 },
760
756 insertTween:{ 761 insertTween:{
757 value:function (clickPos) { 762 value:function (clickPos) {
758 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); 763 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);