From 0013aae80fc22642db6a2753f7dbd5a150f3b3cc Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Mon, 2 Apr 2012 16:04:58 -0700 Subject: TImeline : Bug Fix 1429 & The zoom tweendata Signed-off-by: Kruti Shah --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 2 + js/panels/Timeline/Tween.reel/Tween.js | 120 +++++++++++---------- 2 files changed, 65 insertions(+), 57 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index a82d3373..c454130c 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -777,6 +777,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Delete the selected layer. var myIndex = this.layerRepetition.selectedIndexes[0]; this.arrLayers.splice(myIndex, 1); + var selectIndex = this.arrLayers.length; + this.selectLayer(selectIndex-1); } } }, diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js index 28c9a585..bd62a212 100644 --- a/js/panels/Timeline/Tween.reel/Tween.js +++ b/js/panels/Timeline/Tween.reel/Tween.js @@ -230,68 +230,74 @@ var Tween = exports.Tween = Montage.create(Component, { }, handleTlZoomSlider:{ - value:function(event){ - var currentMilliSecPerPixel , currentMilliSec , clickPos,i=0; - - length = this.application.ninja.timeline.tempArray.length; - if(length > 0 && this.application.ninja.timeline.tempArray[length-1]!== this.parentComponent.parentComponent.trackID){ - this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID); - var i = this.application.ninja.timeline.tweenarray.length-1; - for(;this.currentTween = this.application.ninja.timeline.tweenarray[i];i--){ - if(this.application.ninja.timeline.tweenarray[i].tweenID===0){ - this.currentTween.spanWidth=0; - this.currentTween.spanPosition=0; - this.currentTween.keyFramePosition=0; - this.currentTween.keyFrameMillisec=0; - this.needsDraw=true; - }else{ - currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); - currentMilliSec = this.currentTween.keyFrameMillisec; - clickPos = currentMilliSec / currentMilliSecPerPixel; - this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[i+1].keyFramePosition; - this.currentTween.keyFramePosition = clickPos; - this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth; - this.needsDraw=true; - } + value:function(event){ + var currentMilliSecPerPixel , currentMilliSec , clickPos,thingToPush; + + length = this.application.ninja.timeline.tempArray.length; + if(length > 0 && this.application.ninja.timeline.tempArray[length-1]!== this.parentComponent.parentComponent.trackID){ + this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID); + var i = this.application.ninja.timeline.tweenarray.length-1; + for(var index=0;this.currentTween = this.parentComponent.parentComponent.tweens[index];i--,index++){ + if(this.parentComponent.parentComponent.tweens[index].tweenData.tweenID===0){ + this.currentTween.tweenData.spanWidth=0; + this.currentTween.tweenData.spanPosition=0; + this.currentTween.tweenData.keyFramePosition=0; + this.currentTween.tweenData.keyFrameMillisec=0; + this.setData(); + }else{ + currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); + currentMilliSec = this.currentTween.tweenData.keyFrameMillisec; + clickPos = currentMilliSec / currentMilliSecPerPixel; + this.currentTween.tweenData.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[i+1].keyFramePosition; + this.currentTween.tweenData.keyFramePosition = clickPos; + this.currentTween.tweenData.spanPosition=clickPos-this.currentTween.tweenData.spanWidth; + this.setData(); + } + } + this.application.ninja.timeline.tweenarray=[]; + thingToPush = {}; + thingToPush.tweenID = this.tweenID; + thingToPush.keyFramePosition = this.keyFramePosition; + this.application.ninja.timeline.tweenarray.push(thingToPush); + }else if(length===0){ + this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID); + thingToPush = {}; + thingToPush.tweenID = this.tweenID; + thingToPush.keyFramePosition = this.keyFramePosition; + this.application.ninja.timeline.tweenarray.push(thingToPush); + }else{ + thingToPush = {}; + thingToPush.tweenID = this.tweenID; + thingToPush.keyFramePosition = this.keyFramePosition; + this.application.ninja.timeline.tweenarray.push(thingToPush); } - this.application.ninja.timeline.tweenarray.length=0; - this.application.ninja.timeline.tweenarray.push(this); - }else if(length===0){ - this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID); - this.application.ninja.timeline.tweenarray.push(this); - }else{ - this.application.ninja.timeline.tweenarray.push(this); - } - var levelNumber = this.application.ninja.timeline.getLayerIndexByID(this.parentComponent.parentComponent.trackID); - var k = this.application.ninja.timeline.tweenarray.length-1; - if(this.parentComponent.parentComponent.tweens.length === this.application.ninja.timeline.tweenarray.length && levelNumber===0){ - for(;this.currentTween = this.application.ninja.timeline.tweenarray[k];k--){ - if(this.application.ninja.timeline.tweenarray[k].tweenID===0){ - this.currentTween.spanWidth=0; - this.currentTween.spanPosition=0; - this.currentTween.keyFramePosition=0; - this.currentTween.keyFrameMillisec=0; - this.needsDraw=true; - }else{ - currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); - currentMilliSec = this.currentTween.keyFrameMillisec; - clickPos = currentMilliSec / currentMilliSecPerPixel; - this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[k+1].keyFramePosition; - this.currentTween.keyFramePosition = clickPos; - this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth; - this.needsDraw=true; - } + var levelNumber = this.application.ninja.timeline.getLayerIndexByID(this.parentComponent.parentComponent.trackID); + var k = this.application.ninja.timeline.tweenarray.length-1; + if(this.parentComponent.parentComponent.tweens.length === this.application.ninja.timeline.tweenarray.length && levelNumber===0){ + for(var indexValue=0;this.currentTween = this.parentComponent.parentComponent.tweens[indexValue];k--,indexValue++){ + if(this.parentComponent.parentComponent.tweens[indexValue].tweenData.tweenID===0){ + this.currentTween.tweenData.spanWidth=0; + this.currentTween.tweenData.spanPosition=0; + this.currentTween.tweenData.keyFramePosition=0; + this.currentTween.tweenData.keyFrameMillisec=0; + this.setData(); + }else{ + currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); + currentMilliSec = this.currentTween.tweenData.keyFrameMillisec; + clickPos = currentMilliSec / currentMilliSecPerPixel; + this.currentTween.tweenData.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[k+1].keyFramePosition; + this.currentTween.tweenData.keyFramePosition = clickPos; + this.currentTween.tweenData.spanPosition=clickPos-this.currentTween.tweenData.spanWidth; + this.setData(); + } + } + this.application.ninja.timeline.tempArray=[]; + this.application.ninja.timeline.tweenarray=[]; } - this.application.ninja.timeline.tempArray.length=0; - this.application.ninja.timeline.tweenarray.length=0; } - - - } - } -}); + }); -- cgit v1.2.3