diff options
Diffstat (limited to 'js/panels/Timeline/Keyframe.reel/Keyframe.js')
-rw-r--r-- | js/panels/Timeline/Keyframe.reel/Keyframe.js | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js index 9ded9c76..a52150af 100644 --- a/js/panels/Timeline/Keyframe.reel/Keyframe.js +++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js | |||
@@ -33,6 +33,7 @@ var Component = require("montage/ui/component").Component; | |||
33 | 33 | ||
34 | var Keyframe = exports.Keyframe = Montage.create(Component, { | 34 | var Keyframe = exports.Keyframe = Montage.create(Component, { |
35 | 35 | ||
36 | // ==== Begin models | ||
36 | hasTemplate:{ | 37 | hasTemplate:{ |
37 | value: true | 38 | value: true |
38 | }, | 39 | }, |
@@ -66,7 +67,9 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
66 | this.needsDraw = true; | 67 | this.needsDraw = true; |
67 | } | 68 | } |
68 | }, | 69 | }, |
70 | // ==== End Models | ||
69 | 71 | ||
72 | // ==== Begin Draw cycle methods | ||
70 | prepareForDraw:{ | 73 | prepareForDraw:{ |
71 | value:function(){ | 74 | value:function(){ |
72 | this.element.addEventListener("click", this, false); | 75 | this.element.addEventListener("click", this, false); |
@@ -90,57 +93,31 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
90 | this.element.style.left = (this.position - 5) + "px"; | 93 | this.element.style.left = (this.position - 5) + "px"; |
91 | } | 94 | } |
92 | }, | 95 | }, |
96 | // ==== End Draw cycle methods | ||
93 | 97 | ||
94 | deselectKeyframe:{ | 98 | // ==== Begin Event handlers |
95 | value:function(){ | ||
96 | this.isSelected=false; | ||
97 | this.element.style.left = (this.position - 5) + "px"; | ||
98 | } | ||
99 | }, | ||
100 | |||
101 | selectKeyframe:{ | ||
102 | value:function(){ | ||
103 | if(this.isSelected){ | ||
104 | return; | ||
105 | } | ||
106 | |||
107 | if(this.parentComponent.parentComponent.parentComponent.trackType == "position"){ | ||
108 | var tweenID = this.parentComponent.tweenID; | ||
109 | var mainTrack = this.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent; | ||
110 | mainTrack.childComponents[0].childComponents[tweenID].childComponents[0].selectKeyframe(); | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | this.isSelected=true; | ||
115 | this.element.style.left = (this.position - 6) + "px"; | ||
116 | this.application.ninja.timeline.selectedStyle = this.parentComponent.parentComponent.parentComponent.trackEditorProperty; | ||
117 | this.parentComponent.selectTween(); | ||
118 | } | ||
119 | }, | ||
120 | |||
121 | handleClick:{ | 99 | handleClick:{ |
122 | value:function(ev){ | 100 | value:function(ev){ |
123 | this.selectKeyframe(); | 101 | this.selectKeyframe(); |
124 | ev.stopPropagation(); | 102 | ev.stopPropagation(); |
125 | } | 103 | } |
126 | }, | 104 | }, |
127 | 105 | ||
128 | handleMouseover: { | 106 | handleMouseover: { |
129 | value: function(event) { | 107 | value: function(event) { |
130 | this.element.draggable = true; | 108 | this.element.draggable = true; |
131 | } | 109 | } |
132 | }, | 110 | }, |
111 | |||
133 | handleMouseout: { | 112 | handleMouseout: { |
134 | value: function(event) { | 113 | value: function(event) { |
135 | this.element.draggable = false; | 114 | this.element.draggable = false; |
136 | } | 115 | } |
137 | }, | 116 | }, |
117 | |||
138 | handleDragstart: { | 118 | handleDragstart: { |
139 | value: function(event) { | 119 | value: function(event) { |
140 | //this.parentComponent.parentComponent.dragLayerID = this.layerID; | ||
141 | event.dataTransfer.setData('Text', 'Keyframe'); | 120 | event.dataTransfer.setData('Text', 'Keyframe'); |
142 | |||
143 | // Get my index in my track's tween array | ||
144 | var i = 0, | 121 | var i = 0, |
145 | tweenRepetitionLength = this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents.length, | 122 | tweenRepetitionLength = this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents.length, |
146 | myIndex = null; | 123 | myIndex = null; |
@@ -153,10 +130,38 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
153 | this.selectKeyframe(); | 130 | this.selectKeyframe(); |
154 | } | 131 | } |
155 | }, | 132 | }, |
133 | |||
156 | handleDragend: { | 134 | handleDragend: { |
157 | value: function(event) { | 135 | value: function(event) { |
158 | this.parentComponent.isDragging = false; | 136 | this.parentComponent.isDragging = false; |
159 | } | 137 | } |
160 | } | 138 | }, |
161 | 139 | // ==== End Event handlers | |
140 | |||
141 | // === Begin Controllers | ||
142 | selectKeyframe:{ | ||
143 | value:function(){ | ||
144 | if(this.isSelected){ | ||
145 | return; | ||
146 | } | ||
147 | if(this.parentComponent.parentComponent.parentComponent.trackType == "position"){ | ||
148 | var tweenID = this.parentComponent.tweenID; | ||
149 | var mainTrack = this.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent; | ||
150 | mainTrack.childComponents[0].childComponents[tweenID].childComponents[0].selectKeyframe(); | ||
151 | return; | ||
152 | } | ||
153 | this.isSelected=true; | ||
154 | this.element.style.left = (this.position - 6) + "px"; | ||
155 | this.application.ninja.timeline.selectedStyle = this.parentComponent.parentComponent.parentComponent.trackEditorProperty; | ||
156 | this.parentComponent.selectTween(); | ||
157 | } | ||
158 | }, | ||
159 | |||
160 | deselectKeyframe:{ | ||
161 | value:function () { | ||
162 | this.isSelected = false; | ||
163 | this.element.style.left = (this.position - 5) + "px"; | ||
164 | } | ||
165 | } | ||
166 | // ==== End Controllers | ||
162 | }); | 167 | }); |