aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js60
1 files changed, 50 insertions, 10 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index d5571c3c..836bb60f 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -836,7 +836,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
836 // Drag and drop event handlers 836 // Drag and drop event handlers
837 handleKeyframeDragstart : { 837 handleKeyframeDragstart : {
838 value: function(event) { 838 value: function(event) {
839 var dragIcon = document.createElement("img"); 839 var dragIcon = document.createElement("img"),
840 minPosition = 0,
841 maxPosition = 100000000000;
842
840 event.dataTransfer.effectAllowed = 'move'; 843 event.dataTransfer.effectAllowed = 'move';
841 event.dataTransfer.setData('Text', this.identifier); 844 event.dataTransfer.setData('Text', this.identifier);
842 dragIcon.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAA1JREFUGFdj+P//PwMACPwC/ohfBuAAAAAASUVORK5CYII=" 845 dragIcon.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAA1JREFUGFdj+P//PwMACPwC/ohfBuAAAAAASUVORK5CYII="
@@ -868,6 +871,14 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
868 return curtop; 871 return curtop;
869 } 872 }
870 //this._dragAndDropHelperOffset = findYOffset(this.container_layers); 873 //this._dragAndDropHelperOffset = findYOffset(this.container_layers);
874 if (this.draggingIndex !== (this.tweens.length -1)) {
875 maxPosition = this.tweenRepetition.childComponents[this.draggingIndex +1].keyFramePosition;
876 }
877 if (this.draggingIndex > 1) {
878 minPosition = this.tweenRepetition.childComponents[this.draggingIndex -1].keyFramePosition;
879 }
880 this._keyframeMinPosition = minPosition+2;
881 this._keyframeMaxPosition = maxPosition-9;
871 this._appendHelper = true; 882 this._appendHelper = true;
872 this._deleteHelper = false; 883 this._deleteHelper = false;
873 } 884 }
@@ -894,6 +905,15 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
894 */ 905 */
895 //currPos = event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)- 28; 906 //currPos = event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)- 28;
896 currPos = event.x - 277; 907 currPos = event.x - 277;
908
909 // too much or too little?
910 if (currPos < this._keyframeMinPosition) {
911 currPos = this._keyframeMinPosition;
912 }
913 if (currPos > this._keyframeMaxPosition) {
914 currPos = this._keyframeMaxPosition;
915 }
916
897 this._dragAndDropHelperCoords = currPos + "px"; 917 this._dragAndDropHelperCoords = currPos + "px";
898 this.needsDraw = true; 918 this.needsDraw = true;
899 return false; 919 return false;
@@ -923,16 +943,36 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
923 * 943 *
924 */ 944 */
925 945
926 var currPos = event.x - 277, 946 var currPos = event.x - 274,
927 currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80), 947 currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80),
928 currentMillisec = currentMillisecPerPixel * currPos; 948 currentMillisec = 0,
929 console.log(this.tweens[1].tweenData); 949 i = 0,
930 this.tweens[1].tweenData.spanWidth = currPos - this.tweens[0].tweenData.keyFramePosition; 950 tweenIndex = this.draggingIndex;
931 this.tweens[1].tweenData.keyFramePosition = currPos; 951
932 this.tweens[1].tweenData.keyFrameMillisec = currentMillisec; 952 // too much or too little?
933 this.tweens[1].tweenData.spanPosition = currPos - this.tweens[1].tweenData.spanWidth; 953 if (currPos < this._keyframeMinPosition) {
934 this.tweenRepetition.childComponents[1].setData(); 954 currPos = this._keyframeMinPosition + 3;
935 console.log(this.tweens[1].tweenData); 955 }
956 if (currPos > this._keyframeMaxPosition) {
957 currPos = this._keyframeMaxPosition + 3;
958 }
959
960 currentMillisec = currentMillisecPerPixel * currPos;
961
962 this.tweens[tweenIndex].tweenData.spanWidth = currPos - this.tweens[tweenIndex - 1].tweenData.keyFramePosition;
963 this.tweens[tweenIndex].tweenData.keyFramePosition = currPos;
964 this.tweens[tweenIndex].tweenData.keyFrameMillisec = currentMillisec;
965 this.tweens[tweenIndex].tweenData.spanPosition = currPos - this.tweens[tweenIndex].tweenData.spanWidth;
966 this.tweenRepetition.childComponents[tweenIndex].setData();
967 if (tweenIndex < this.tweens.length -1) {
968 var spanWidth = this.tweens[tweenIndex +1].tweenData.keyFramePosition - currPos;
969 var spanPosition = currPos;
970 this.tweens[tweenIndex +1].tweenData.spanWidth = spanWidth;
971 this.tweens[tweenIndex +1].tweenData.spanPosition = currPos;
972 this.tweenRepetition.childComponents[tweenIndex+1].setData();
973 }
974 this.tweenRepetition.childComponents[tweenIndex].selectTween();
975 this.updateKeyframeRule();
936 return false; 976 return false;
937 } 977 }
938 }, 978 },