From 04f206173530b6efde16b934b1f959b255d18441 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 22 Jun 2012 01:33:58 -0700 Subject: FIx - can't delete keyframes F5 now deletes the selected keyframe Signed-off-by: Jonathan Duran --- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 60 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 10 deletions(-) (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index bf380e00..85fce1ec 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -702,17 +702,22 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { handleKeyboardShortcut:{ value:function(ev){ - if (this.tweens.length < 1) { - this.insertTween(0); - this.addAnimationRuleToElement(ev); - this.updateKeyframeRule(); - } else { - //this.handleNewTween(ev); - - // Split a tween! - this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft) - this.updateKeyframeRule(); + if(ev.actionType == "insert"){ + if (this.tweens.length < 1) { + this.insertTween(0); + this.addAnimationRuleToElement(ev); + this.updateKeyframeRule(); + } else { + this.handleNewTween(ev); + + // Split a tween! + //this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft); + this.updateKeyframeRule(); + } + } else if(ev.actionType == "remove"){ + this.removeTween(); } + } }, @@ -801,6 +806,41 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { } }, + removeTween:{ + value:function(){ + var tweenIDToRemove = this.application.ninja.timeline.selectedTweens[0].tweenID, + oldPosition = this.application.ninja.timeline.selectedTweens[0].spanPosition, + oldSpanWidth = this.application.ninja.timeline.selectedTweens[0].spanWidth; + + if(tweenIDToRemove == this.tweens[this.tweens.length-1].tweenData.tweenID){ + this.trackDuration = this.tweens[this.tweens.length-2].tweenData.keyFrameMillisec; + this.tweens.pop(); + return; + } + + // Update the next tween to have new span position and width. + this.tweens[tweenIDToRemove + 1].tweenData.spanPosition = oldPosition; + this.tweens[tweenIDToRemove + 1].spanPosition = oldPosition; + this.tweens[tweenIDToRemove + 1].tweenData.spanWidth = this.tweens[tweenIDToRemove + 1].tweenData.spanWidth + oldSpanWidth; + this.tweens[tweenIDToRemove + 1].spanWidth = this.tweens[tweenIDToRemove + 1].spanWidth + oldSpanWidth; + + // redraw the tweens + for(var i in this.tweenRepetition.childComponents){ + this.tweenRepetition.childComponents[i].setData(); + } + + // remove the selected tween + this.tweens.splice(tweenIDToRemove, 1); + this.application.ninja.currentDocument.model.needsSave = true; + + // update the tween ids + for (var j = 0; j < this.tweens.length; j++) { + this.tweens[j].tweenID = j; + this.tweens[j].tweenData.tweenID = j; + } + } + }, + createMatchingPositionSizeTween:{ value:function (newTween) { var i; -- cgit v1.2.3 From 21edfc9a02df0ab4360d5eb41f9ef036500c681b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 25 Jun 2012 08:12:21 -0700 Subject: Timeline Fix - reopen subprop keyframes for Position and Size correctly Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 85fce1ec..68ea928a 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -709,15 +709,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this.updateKeyframeRule(); } else { this.handleNewTween(ev); - - // Split a tween! - //this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft); this.updateKeyframeRule(); } } else if(ev.actionType == "remove"){ this.removeTween(); + this.updateKeyframeRule(); } - } }, @@ -800,8 +797,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this.createMatchingPositionSizeTween(newTween); } - - this.application.ninja.currentDocument.model.needsSave = true; } }, @@ -995,6 +990,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { newTween.tweenData.easing = "none"; } this.tweens.push(newTween); + this.createMatchingPositionSizeTween(newTween); } this.nextKeyframe += 1; } @@ -1022,8 +1018,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { value:function(ruleSet){ for(var i in ruleSet){ var styleProp = ruleSet[i][0].style[0]; - //console.log(styleProp); - //console.log(ruleSet[i]); this.application.ninja.timeline.layerRepetition.childComponents[0].addStyle(styleProp, ruleSet[i]); } } -- cgit v1.2.3