diff options
author | Valerio Virgillito | 2012-06-26 09:14:30 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-26 09:14:30 -0700 |
commit | b4ca7c50790381bddeebb417c1d0477344c77cff (patch) | |
tree | 0c8d536cb0e75ceaf757b9ae2e7b5df85fc8556c /js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |
parent | d2e88bb251efb29f13911942f1f91101715c727e (diff) | |
parent | 8b46c251664a45039db355075bce85ddfd345269 (diff) | |
download | ninja-b4ca7c50790381bddeebb417c1d0477344c77cff.tar.gz |
Merge pull request #335 from imix23ways/Timeline-bugfix1
Timeline fix - reopen Position and Size keyframe correctly
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index bf380e00..68ea928a 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -702,15 +702,17 @@ 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 | this.updateKeyframeRule(); |
713 | this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft) | 713 | } |
714 | } else if(ev.actionType == "remove"){ | ||
715 | this.removeTween(); | ||
714 | this.updateKeyframeRule(); | 716 | this.updateKeyframeRule(); |
715 | } | 717 | } |
716 | } | 718 | } |
@@ -795,9 +797,42 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
795 | this.createMatchingPositionSizeTween(newTween); | 797 | this.createMatchingPositionSizeTween(newTween); |
796 | } | 798 | } |
797 | 799 | ||
800 | this.application.ninja.currentDocument.model.needsSave = true; | ||
801 | } | ||
802 | }, | ||
803 | |||
804 | removeTween:{ | ||
805 | value:function(){ | ||
806 | var tweenIDToRemove = this.application.ninja.timeline.selectedTweens[0].tweenID, | ||
807 | oldPosition = this.application.ninja.timeline.selectedTweens[0].spanPosition, | ||
808 | oldSpanWidth = this.application.ninja.timeline.selectedTweens[0].spanWidth; | ||
809 | |||
810 | if(tweenIDToRemove == this.tweens[this.tweens.length-1].tweenData.tweenID){ | ||
811 | this.trackDuration = this.tweens[this.tweens.length-2].tweenData.keyFrameMillisec; | ||
812 | this.tweens.pop(); | ||
813 | return; | ||
814 | } | ||
815 | |||
816 | // Update the next tween to have new span position and width. | ||
817 | this.tweens[tweenIDToRemove + 1].tweenData.spanPosition = oldPosition; | ||
818 | this.tweens[tweenIDToRemove + 1].spanPosition = oldPosition; | ||
819 | this.tweens[tweenIDToRemove + 1].tweenData.spanWidth = this.tweens[tweenIDToRemove + 1].tweenData.spanWidth + oldSpanWidth; | ||
820 | this.tweens[tweenIDToRemove + 1].spanWidth = this.tweens[tweenIDToRemove + 1].spanWidth + oldSpanWidth; | ||
798 | 821 | ||
822 | // redraw the tweens | ||
823 | for(var i in this.tweenRepetition.childComponents){ | ||
824 | this.tweenRepetition.childComponents[i].setData(); | ||
825 | } | ||
799 | 826 | ||
827 | // remove the selected tween | ||
828 | this.tweens.splice(tweenIDToRemove, 1); | ||
800 | this.application.ninja.currentDocument.model.needsSave = true; | 829 | this.application.ninja.currentDocument.model.needsSave = true; |
830 | |||
831 | // update the tween ids | ||
832 | for (var j = 0; j < this.tweens.length; j++) { | ||
833 | this.tweens[j].tweenID = j; | ||
834 | this.tweens[j].tweenData.tweenID = j; | ||
835 | } | ||
801 | } | 836 | } |
802 | }, | 837 | }, |
803 | 838 | ||
@@ -955,6 +990,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
955 | newTween.tweenData.easing = "none"; | 990 | newTween.tweenData.easing = "none"; |
956 | } | 991 | } |
957 | this.tweens.push(newTween); | 992 | this.tweens.push(newTween); |
993 | this.createMatchingPositionSizeTween(newTween); | ||
958 | } | 994 | } |
959 | this.nextKeyframe += 1; | 995 | this.nextKeyframe += 1; |
960 | } | 996 | } |
@@ -982,8 +1018,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
982 | value:function(ruleSet){ | 1018 | value:function(ruleSet){ |
983 | for(var i in ruleSet){ | 1019 | for(var i in ruleSet){ |
984 | var styleProp = ruleSet[i][0].style[0]; | 1020 | var styleProp = ruleSet[i][0].style[0]; |
985 | //console.log(styleProp); | ||
986 | //console.log(ruleSet[i]); | ||
987 | this.application.ninja.timeline.layerRepetition.childComponents[0].addStyle(styleProp, ruleSet[i]); | 1021 | this.application.ninja.timeline.layerRepetition.childComponents[0].addStyle(styleProp, ruleSet[i]); |
988 | } | 1022 | } |
989 | } | 1023 | } |