aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Tween.reel
diff options
context:
space:
mode:
authorJonathan Duran2012-03-27 14:07:30 -0700
committerJonathan Duran2012-03-27 14:07:30 -0700
commit06f247d881f4cfd790d635c6e310ae7f97724339 (patch)
tree65479300389d3919ca2eeef29a24ab4f63c9c773 /js/panels/Timeline/Tween.reel
parent7bcc313f6d8b3b0228e11bd4eee0278b1142e1f8 (diff)
parent6a327041ebd9b921ddeacb6582a143ac8a12c5c3 (diff)
downloadninja-06f247d881f4cfd790d635c6e310ae7f97724339.tar.gz
Merge branch 'Timeline-latest-change' of github.com:ntfx47/ninja-internal into TimelineUber
Conflicts: js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline/Tween.reel')
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js75
1 files changed, 75 insertions, 0 deletions
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index 77aeb4a7..28c9a585 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -44,6 +44,7 @@ var Tween = exports.Tween = Montage.create(Component, {
44 }, 44 },
45 set: function(value){ 45 set: function(value){
46 this._spanWidth = value; 46 this._spanWidth = value;
47 this.needsDraw=true;
47 } 48 }
48 }, 49 },
49 50
@@ -58,6 +59,7 @@ var Tween = exports.Tween = Montage.create(Component, {
58 }, 59 },
59 set:function (value) { 60 set:function (value) {
60 this._spanPosition = value; 61 this._spanPosition = value;
62 this.needsDraw=true;
61 } 63 }
62 }, 64 },
63 65
@@ -72,6 +74,7 @@ var Tween = exports.Tween = Montage.create(Component, {
72 }, 74 },
73 set:function (value) { 75 set:function (value) {
74 this._keyFramePosition = value; 76 this._keyFramePosition = value;
77 this.needsDraw=true;
75 } 78 }
76 }, 79 },
77 80
@@ -133,6 +136,12 @@ var Tween = exports.Tween = Montage.create(Component, {
133 } 136 }
134 }, 137 },
135 138
139 prepareForDraw:{
140 value:function(){
141 this.eventManager.addEventListener("tlZoomSlider", this, false);
142 }
143 },
144
136 draw:{ 145 draw:{
137 value:function () { 146 value:function () {
138 this.element.style.left = this.spanPosition + "px"; 147 this.element.style.left = this.spanPosition + "px";
@@ -218,5 +227,71 @@ var Tween = exports.Tween = Montage.create(Component, {
218 // deselect the keyframe for this tween 227 // deselect the keyframe for this tween
219 this.keyframe.deselectKeyframe(); 228 this.keyframe.deselectKeyframe();
220 } 229 }
230 },
231
232 handleTlZoomSlider:{
233 value:function(event){
234 var currentMilliSecPerPixel , currentMilliSec , clickPos,i=0;
235
236 length = this.application.ninja.timeline.tempArray.length;
237 if(length > 0 && this.application.ninja.timeline.tempArray[length-1]!== this.parentComponent.parentComponent.trackID){
238 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
239 var i = this.application.ninja.timeline.tweenarray.length-1;
240 for(;this.currentTween = this.application.ninja.timeline.tweenarray[i];i--){
241 if(this.application.ninja.timeline.tweenarray[i].tweenID===0){
242 this.currentTween.spanWidth=0;
243 this.currentTween.spanPosition=0;
244 this.currentTween.keyFramePosition=0;
245 this.currentTween.keyFrameMillisec=0;
246 this.needsDraw=true;
247 }else{
248 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
249 currentMilliSec = this.currentTween.keyFrameMillisec;
250 clickPos = currentMilliSec / currentMilliSecPerPixel;
251 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[i+1].keyFramePosition;
252 this.currentTween.keyFramePosition = clickPos;
253 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
254 this.needsDraw=true;
255 }
256
257 }
258 this.application.ninja.timeline.tweenarray.length=0;
259 this.application.ninja.timeline.tweenarray.push(this);
260 }else if(length===0){
261 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
262 this.application.ninja.timeline.tweenarray.push(this);
263 }else{
264 this.application.ninja.timeline.tweenarray.push(this);
265 }
266
267 var levelNumber = this.application.ninja.timeline.getLayerIndexByID(this.parentComponent.parentComponent.trackID);
268 var k = this.application.ninja.timeline.tweenarray.length-1;
269 if(this.parentComponent.parentComponent.tweens.length === this.application.ninja.timeline.tweenarray.length && levelNumber===0){
270 for(;this.currentTween = this.application.ninja.timeline.tweenarray[k];k--){
271 if(this.application.ninja.timeline.tweenarray[k].tweenID===0){
272 this.currentTween.spanWidth=0;
273 this.currentTween.spanPosition=0;
274 this.currentTween.keyFramePosition=0;
275 this.currentTween.keyFrameMillisec=0;
276 this.needsDraw=true;
277 }else{
278 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
279 currentMilliSec = this.currentTween.keyFrameMillisec;
280 clickPos = currentMilliSec / currentMilliSecPerPixel;
281 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[k+1].keyFramePosition;
282 this.currentTween.keyFramePosition = clickPos;
283 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
284 this.needsDraw=true;
285 }
286
287 }
288 this.application.ninja.timeline.tempArray.length=0;
289 this.application.ninja.timeline.tweenarray.length=0;
290 }
291
292
293
294 }
221 } 295 }
296
222}); 297});