diff options
author | Jose Antonio Marquez | 2012-06-26 11:01:51 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-26 11:01:51 -0700 |
commit | 879dc3285feef07bc532d3f51fdb8cdba8048313 (patch) | |
tree | 59c66dd62e20d2a1f01a284564d82e66d62f7ca3 /js | |
parent | dde59258c3979b990913ad1f14b0e55828a38906 (diff) | |
parent | dea90d1bb0b903a7497cdf7de9ae60799e60d5b1 (diff) | |
download | ninja-879dc3285feef07bc532d3f51fdb8cdba8048313.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into Color
Diffstat (limited to 'js')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 7 | ||||
-rwxr-xr-x | js/panels/Splitter.js | 8 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 12 | ||||
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 56 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 16 | ||||
-rwxr-xr-x | js/tools/PanTool.js | 6 |
6 files changed, 73 insertions, 32 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/Splitter.js b/js/panels/Splitter.js index c6d46911..4f2a137e 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js | |||
@@ -156,7 +156,7 @@ exports.Splitter = Montage.create(Component, { | |||
156 | } | 156 | } |
157 | }, | 157 | }, |
158 | restore:{ | 158 | restore:{ |
159 | value: function() { | 159 | value: function(onSwitchFromCodeDocument) { |
160 | //Get splitter initial value from SettingManager | 160 | //Get splitter initial value from SettingManager |
161 | var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; | 161 | var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; |
162 | if(storedData && this.element.getAttribute("data-montage-id") !== null) { | 162 | if(storedData && this.element.getAttribute("data-montage-id") !== null) { |
@@ -172,7 +172,11 @@ exports.Splitter = Montage.create(Component, { | |||
172 | this.panel.addEventListener("webkitTransitionEnd", this, false); | 172 | this.panel.addEventListener("webkitTransitionEnd", this, false); |
173 | } | 173 | } |
174 | this.disabled = false; | 174 | this.disabled = false; |
175 | this.needsDraw = true; | 175 | if(onSwitchFromCodeDocument) { |
176 | this.draw(); // When switching from code document, draw immediately so stage size is correct | ||
177 | } else { | ||
178 | this.needsDraw = true; | ||
179 | } | ||
176 | } | 180 | } |
177 | } | 181 | } |
178 | } | 182 | } |
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 2cbd9e2b..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, { | |||
869 | this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); | 869 | this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); |
870 | this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); | 870 | this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); |
871 | 871 | ||
872 | // Bind some bindings | ||
873 | Object.defineBinding(this, "currentSelectedContainer", { | ||
874 | boundObject:this.application.ninja, | ||
875 | boundObjectPropertyPath:"currentSelectedContainer", | ||
876 | oneway:true | ||
877 | }); | ||
878 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); | 872 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); |
879 | 873 | ||
880 | // Start the panel out in disabled mode by default | 874 | // Start the panel out in disabled mode by default |
@@ -1034,17 +1028,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1034 | }, | 1028 | }, |
1035 | 1029 | ||
1036 | handleKeyframeShortcut:{ | 1030 | handleKeyframeShortcut:{ |
1037 | value:function(){ | 1031 | value:function(action){ |
1038 | //console.log(this.currentLayersSelected); | ||
1039 | //console.log(this.trackRepetition); | ||
1040 | var tempEv = {}; | 1032 | var tempEv = {}; |
1041 | tempEv.offsetX = this.playheadmarker.offsetLeft; | 1033 | tempEv.offsetX = this.playheadmarker.offsetLeft; |
1034 | tempEv.actionType = action; | ||
1042 | if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { | 1035 | if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { |
1043 | this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); | 1036 | this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); |
1044 | } else { | 1037 | } else { |
1045 | // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. | 1038 | // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. |
1046 | } | 1039 | } |
1047 | |||
1048 | } | 1040 | } |
1049 | }, | 1041 | }, |
1050 | 1042 | ||
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 | } |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 5e913c76..319ffe87 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -19,6 +19,7 @@ exports.Stage = Montage.create(Component, { | |||
19 | // TODO - Need to figure out how to remove this dependency | 19 | // TODO - Need to figure out how to remove this dependency |
20 | // Needed by some tools that depend on selectionDrawn event to set up some logic | 20 | // Needed by some tools that depend on selectionDrawn event to set up some logic |