diff options
author | Jon Reid | 2012-05-03 18:06:06 -0700 |
---|---|---|
committer | Jon Reid | 2012-05-03 18:06:06 -0700 |
commit | 7fc185cc08b2ba912dbc7bce96f6a465c1dd6dbf (patch) | |
tree | e5d5c48dffff901cd699037346fb509d7998691a | |
parent | d582eb28c04eb8e1f1fa7a729ee20f2e7a0fb935 (diff) | |
download | ninja-7fc185cc08b2ba912dbc7bce96f6a465c1dd6dbf.tar.gz |
Timeline: More work on tween drag-and-drop
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 23 | ||||
-rw-r--r-- | js/panels/Timeline/Tween.reel/Tween.js | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 09378e65..d5571c3c 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -442,6 +442,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
442 | this.element.addEventListener("click", this, false); | 442 | this.element.addEventListener("click", this, false); |
443 | this.eventManager.addEventListener("tlZoomSlider", this, false); | 443 | this.eventManager.addEventListener("tlZoomSlider", this, false); |
444 | 444 | ||
445 | // Drag and Drop event handlers | ||
445 | this.element.addEventListener("dragover", this.handleKeyframeDragover.bind(this), false); | 446 | this.element.addEventListener("dragover", this.handleKeyframeDragover.bind(this), false); |
446 | this.element.addEventListener("dragstart", this.handleKeyframeDragstart.bind(this), false); | 447 | this.element.addEventListener("dragstart", this.handleKeyframeDragstart.bind(this), false); |
447 | this.element.addEventListener("dragend", this.handleKeyframeDragend.bind(this), false); | 448 | this.element.addEventListener("dragend", this.handleKeyframeDragend.bind(this), false); |
@@ -873,6 +874,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
873 | }, | 874 | }, |
874 | handleKeyframeDragover: { | 875 | handleKeyframeDragover: { |
875 | value: function(event) { | 876 | value: function(event) { |
877 | event.preventDefault(); | ||
876 | var currPos = 0; | 878 | var currPos = 0; |
877 | /* | 879 | /* |
878 | myScrollTest = ((event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)) + 28) - this.user_layers.scrollTop; | 880 | myScrollTest = ((event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)) + 28) - this.user_layers.scrollTop; |
@@ -891,9 +893,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
891 | } | 893 | } |
892 | */ | 894 | */ |
893 | //currPos = event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)- 28; | 895 | //currPos = event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)- 28; |
894 | currPos = event.x - 280; | 896 | currPos = event.x - 277; |
895 | this._dragAndDropHelperCoords = currPos + "px"; | 897 | this._dragAndDropHelperCoords = currPos + "px"; |
896 | this.needsDraw = true; | 898 | this.needsDraw = true; |
899 | return false; | ||
897 | } | 900 | } |
898 | }, | 901 | }, |
899 | 902 | ||
@@ -912,6 +915,24 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
912 | //if (this.parentComponent.parentComponent.dragLayerID !== this.layerID) { | 915 | //if (this.parentComponent.parentComponent.dragLayerID !== this.layerID) { |
913 | //this.parentComponent.parentComponent.dropLayerID = this.layerID; | 916 | //this.parentComponent.parentComponent.dropLayerID = this.layerID; |
914 | //} | 917 | //} |
918 | |||
919 | /* | ||
920 | * First, what keyframe is it (get the index); | ||
921 | * Limit keyframe position to between index-1 and index+1 keyFramePosition | ||
922 | * On update, be sure to update index+1's information too | ||
923 | * | ||
924 | */ | ||
925 | |||
926 | var currPos = event.x - 277, | ||
927 | currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80), | ||
928 | currentMillisec = currentMillisecPerPixel * currPos; | ||
929 | console.log(this.tweens[1].tweenData); | ||
930 | this.tweens[1].tweenData.spanWidth = currPos - this.tweens[0].tweenData.keyFramePosition; | ||
931 | this.tweens[1].tweenData.keyFramePosition = currPos; | ||
932 | this.tweens[1].tweenData.keyFrameMillisec = currentMillisec; | ||
933 | this.tweens[1].tweenData.spanPosition = currPos - this.tweens[1].tweenData.spanWidth; | ||
934 | this.tweenRepetition.childComponents[1].setData(); | ||
935 | console.log(this.tweens[1].tweenData); | ||
915 | return false; | 936 | return false; |
916 | } | 937 | } |
917 | }, | 938 | }, |
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js index 8b6826ed..b4c3bd86 100644 --- a/js/panels/Timeline/Tween.reel/Tween.js +++ b/js/panels/Timeline/Tween.reel/Tween.js | |||
@@ -136,6 +136,7 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
136 | 136 | ||
137 | draw:{ | 137 | draw:{ |
138 | value:function () { | 138 | value:function () { |
139 | console.log("Tween.draw") | ||
139 | this.element.style.left = this.spanPosition + "px"; | 140 | this.element.style.left = this.spanPosition + "px"; |
140 | this.keyframe.position = this.spanWidth; | 141 | this.keyframe.position = this.spanWidth; |
141 | this.tweenspan.spanWidth = this.spanWidth; | 142 | this.tweenspan.spanWidth = this.spanWidth; |
@@ -147,6 +148,7 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
147 | 148 | ||
148 | setData:{ | 149 | setData:{ |
149 | value:function(){ | 150 | value:function(){ |
151 | console.log("Tween.setData") | ||
150 | this.spanWidth = this.tweenData.spanWidth; | 152 | this.spanWidth = this.tweenData.spanWidth; |
151 | this.keyFramePosition = this.tweenData.keyFramePosition; | 153 | this.keyFramePosition = this.tweenData.keyFramePosition; |
152 | this.spanPosition = this.tweenData.spanPosition; | 154 | this.spanPosition = this.tweenData.spanPosition; |