aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Tween.reel
diff options
context:
space:
mode:
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 2b308d9a..e8c7e187 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";
@@ -217,5 +226,71 @@ var Tween = exports.Tween = Montage.create(Component, {
217 // deselect the keyframe for this tween 226 // deselect the keyframe for this tween
218 this.keyframe.deselectKeyframe(); 227 this.keyframe.deselectKeyframe();
219 } 228 }
229 },
230
231 handleTlZoomSlider:{
232 value:function(event){
233 var currentMilliSecPerPixel , currentMilliSec , clickPos,i=0;
234
235 length = this.application.ninja.timeline.tempArray.length;
236 if(length > 0 && this.application.ninja.timeline.tempArray[length-1]!== this.parentComponent.parentComponent.trackID){
237 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
238 var i = this.application.ninja.timeline.tweenarray.length-1;
239 for(;this.currentTween = this.application.ninja.timeline.tweenarray[i];i--){
240 if(this.application.ninja.timeline.tweenarray[i].tweenID===0){
241 this.currentTween.spanWidth=0;
242 this.currentTween.spanPosition=0;
243 this.currentTween.keyFramePosition=0;
244 this.currentTween.keyFrameMillisec=0;
245 this.needsDraw=true;
246 }else{
247 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
248 currentMilliSec = this.currentTween.keyFrameMillisec;
249 clickPos = currentMilliSec / currentMilliSecPerPixel;
250 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[i+1].keyFramePosition;
251 this.currentTween.keyFramePosition = clickPos;
252 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
253 this.needsDraw=true;
254 }
255
256 }
257 this.application.ninja.timeline.tweenarray.length=0;
258 this.application.ninja.timeline.tweenarray.push(this);
259 }else if(length===0){
260 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
261 this.application.ninja.timeline.tweenarray.push(this);
262 }else{
263 this.application.ninja.timeline.tweenarray.push(this);
264 }
265
266 var levelNumber = this.application.ninja.timeline.getLayerIndexByID(this.parentComponent.parentComponent.trackID);
267 var k = this.application.ninja.timeline.tweenarray.length-1;
268 if(this.parentComponent.parentComponent.tweens.length === this.application.ninja.timeline.tweenarray.length && levelNumber===0){
269 for(;this.currentTween = this.application.ninja.timeline.tweenarray[k];k--){
270 if(this.application.ninja.timeline.tweenarray[k].tweenID===0){
271 this.currentTween.spanWidth=0;
272 this.currentTween.spanPosition=0;
273 this.currentTween.keyFramePosition=0;
274 this.currentTween.keyFrameMillisec=0;
275 this.needsDraw=true;
276 }else{
277 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
278 currentMilliSec = this.currentTween.keyFrameMillisec;
279 clickPos = currentMilliSec / currentMilliSecPerPixel;
280 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[k+1].keyFramePosition;
281 this.currentTween.keyFramePosition = clickPos;
282 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
283 this.needsDraw=true;
284 }
285
286 }
287 this.application.ninja.timeline.tempArray.length=0;
288 this.application.ninja.timeline.tweenarray.length=0;
289 }
290
291
292
293 }
220 } 294 }
295
221}); 296});