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 --- js/mediators/keyboard-mediator.js | 7 ++- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 6 +-- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 60 ++++++++++++++++++---- 3 files changed, 58 insertions(+), 15 deletions(-) (limited to 'js') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index cce053bc..f0afff13 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -50,6 +50,7 @@ var Keyboard = exports.Keyboard = { X:88, Y:89, Z:90, + F5:116, F6:117, PLUS:187, MINUS:189 @@ -218,7 +219,11 @@ exports.KeyboardMediator = Montage.create(Component, { // F6 keyboard shortcut to add a keyframe to the timeline if (evt.keyCode == Keyboard.F6) { - this.application.ninja.timeline.handleKeyframeShortcut(); + this.application.ninja.timeline.handleKeyframeShortcut("insert"); + return; + } + if (evt.keyCode == Keyboard.F5) { + this.application.ninja.timeline.handleKeyframeShortcut("remove"); return; } 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, { }, handleKeyframeShortcut:{ - value:function(){ - //console.log(this.currentLayersSelected); - //console.log(this.trackRepetition); + value:function(action){ var tempEv = {}; tempEv.offsetX = this.playheadmarker.offsetLeft; + tempEv.actionType = action; if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); } else { // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. } - } }, 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 7563c059270d08395f52d9349bbe4d9aa9d9b99f Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 22 Jun 2012 11:22:47 -0700 Subject: Timeline fix - remove unneeded binding Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 1c023fdb..53a3b299 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -869,12 +869,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); - // Bind some bindings - Object.defineBinding(this, "currentSelectedContainer", { - boundObject:this.application.ninja, - boundObjectPropertyPath:"currentSelectedContainer", - oneway:true - }); this.addPropertyChangeListener("currentDocument.model.domContainer", this); // Start the panel out in disabled mode by default -- 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') 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