diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 7 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 6 | ||||
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 60 |
3 files changed, 58 insertions, 15 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index c7288d28..18568619 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -50,6 +50,7 @@ var Keyboard = exports.Keyboard = { | |||
50 | X:88, | 50 | X:88, |
51 | Y:89, | 51 | Y:89, |
52 | Z:90, | 52 | Z:90, |
53 | F5:116, | ||
53 | F6:117, | 54 | F6:117, |
54 | PLUS:187, | 55 | PLUS:187, |
55 | MINUS:189 | 56 | MINUS:189 |
@@ -218,7 +219,11 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
218 | 219 | ||
219 | // F6 keyboard shortcut to add a keyframe to the timeline | 220 | // F6 keyboard shortcut to add a keyframe to the timeline |
220 | if (evt.keyCode == Keyboard.F6) { | 221 | if (evt.keyCode == Keyboard.F6) { |
221 | this.application.ninja.timeline.handleKeyframeShortcut(); | 222 | this.application.ninja.timeline.handleKeyframeShortcut("insert"); |
223 | return; | ||
224 | } | ||
225 | if (evt.keyCode == Keyboard.F5) { | ||
226 | this.application.ninja.timeline.handleKeyframeShortcut("remove"); | ||
222 | return; | 227 | return; |
223 | } | 228 | } |
224 | 229 | ||
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 2cbd9e2b..1c023fdb 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -1034,17 +1034,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1034 | }, | 1034 | }, |
1035 | 1035 | ||
1036 | handleKeyframeShortcut:{ | 1036 | handleKeyframeShortcut:{ |
1037 | value:function(){ | 1037 | value:function(action){ |
1038 | //console.log(this.currentLayersSelected); | ||
1039 | //console.log(this.trackRepetition); | ||
1040 | var tempEv = {}; | 1038 | var tempEv = {}; |
1041 | tempEv.offsetX = this.playheadmarker.offsetLeft; | 1039 | tempEv.offsetX = this.playheadmarker.offsetLeft; |
1040 | tempEv.actionType = action; | ||
1042 | if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { | 1041 | if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { |
1043 | this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); | 1042 | this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); |
1044 | } else { | 1043 | } else { |
1045 | // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. | 1044 | // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. |
1046 | } | 1045 | } |
1047 | |||
1048 | } | 1046 | } |
1049 | }, | 1047 | }, |
1050 | 1048 | ||
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; |