aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
diff options
context:
space:
mode:
authorJonathan Duran2012-06-22 01:33:58 -0700
committerJonathan Duran2012-06-22 01:33:58 -0700
commit04f206173530b6efde16b934b1f959b255d18441 (patch)
treec95cf06050324d1fb4098ceca5229922505566ca /js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
parentc411f76d89c543837548085ff468fee0fb4f2ff9 (diff)
downloadninja-04f206173530b6efde16b934b1f959b255d18441.tar.gz
FIx - can't delete keyframes
F5 now deletes the selected keyframe Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js60
1 files changed, 50 insertions, 10 deletions
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, {
702 702
703 handleKeyboardShortcut:{ 703 handleKeyboardShortcut:{
704 value:function(ev){ 704 value:function(ev){
705 if (this.tweens.length < 1) { 705 if(ev.actionType == "insert"){
706 this.insertTween(0); 706 if (this.tweens.length < 1) {
707 this.addAnimationRuleToElement(ev); 707 this.insertTween(0);
708 this.updateKeyframeRule(); 708 this.addAnimationRuleToElement(ev);
709 } else { 709 this.updateKeyframeRule();
710 //this.handleNewTween(ev); 710 } else {
711 711 this.handleNewTween(ev);
712 // Split a tween! 712
713 this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft) 713 // Split a tween!
714 this.updateKeyframeRule(); 714 //this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft);
715 this.updateKeyframeRule();
716 }
717 } else if(ev.actionType == "remove"){
718 this.removeTween();
715 } 719 }
720
716 } 721 }
717 }, 722 },
718 723
@@ -801,6 +806,41 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
801 } 806 }
802 }, 807 },
803 808
809 removeTween:{
810 value:function(){
811 var tweenIDToRemove = this.application.ninja.timeline.selectedTweens[0].tweenID,
812 oldPosition = this.application.ninja.timeline.selectedTweens[0].spanPosition,
813 oldSpanWidth = this.application.ninja.timeline.selectedTweens[0].spanWidth;
814
815 if(tweenIDToRemove == this.tweens[this.tweens.length-1].tweenData.tweenID){
816 this.trackDuration = this.tweens[this.tweens.length-2].tweenData.keyFrameMillisec;
817 this.tweens.pop();
818 return;
819 }
820
821 // Update the next tween to have new span position and width.
822 this.tweens[tweenIDToRemove + 1].tweenData.spanPosition = oldPosition;
823 this.tweens[tweenIDToRemove + 1].spanPosition = oldPosition;
824 this.tweens[tweenIDToRemove + 1].tweenData.spanWidth = this.tweens[tweenIDToRemove + 1].tweenData.spanWidth + oldSpanWidth;
825 this.tweens[tweenIDToRemove + 1].spanWidth = this.tweens[tweenIDToRemove + 1].spanWidth + oldSpanWidth;
826
827 // redraw the tweens
828 for(var i in this.tweenRepetition.childComponents){
829 this.tweenRepetition.childComponents[i].setData();
830 }
831
832 // remove the selected tween
833 this.tweens.splice(tweenIDToRemove, 1);
834 this.application.ninja.currentDocument.model.needsSave = true;
835
836 // update the tween ids
837 for (var j = 0; j < this.tweens.length; j++) {
838 this.tweens[j].tweenID = j;
839 this.tweens[j].tweenData.tweenID = j;
840 }
841 }
842 },
843
804 createMatchingPositionSizeTween:{ 844 createMatchingPositionSizeTween:{
805 value:function (newTween) { 845 value:function (newTween) {
806 var i; 846 var i;