diff options
Diffstat (limited to 'js/panels/Timeline/Track.reel/Track.js')
-rw-r--r-- | js/panels/Timeline/Track.reel/Track.js | 212 |
1 files changed, 0 insertions, 212 deletions
diff --git a/js/panels/Timeline/Track.reel/Track.js b/js/panels/Timeline/Track.reel/Track.js deleted file mode 100644 index 86acde4f..00000000 --- a/js/panels/Timeline/Track.reel/Track.js +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | Copyright (c) 2012, Motorola Mobility LLC. | ||
3 | All Rights Reserved. | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without | ||
6 | modification, are permitted provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, | ||
9 | this list of conditions and the following disclaimer. | ||
10 | |||
11 | * Redistributions in binary form must reproduce the above copyright notice, | ||
12 | this list of conditions and the following disclaimer in the documentation | ||
13 | and/or other materials provided with the distribution. | ||
14 | |||
15 | * Neither the name of Motorola Mobility LLC nor the names of its | ||
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
18 | |||
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
29 | POSSIBILITY OF SUCH DAMAGE. | ||
30 | </copyright> */ | ||
31 | |||
32 | var Montage = require("montage/core/core").Montage; | ||
33 | var Component = require("montage/ui/component").Component; | ||
34 | var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; | ||
35 | |||
36 | var Track = exports.Track = Montage.create(Component, { | ||
37 | |||
38 | track_lane: { | ||
39 | value: null, | ||
40 | serializable: true | ||
41 | }, | ||
42 | |||
43 | _trackID:{ | ||
44 | value:null | ||
45 | }, | ||
46 | |||
47 | trackID:{ | ||
48 | get:function(){ | ||
49 | return this._trackID; | ||
50 | }, | ||
51 | set:function(value){ | ||
52 | this._trackID = value; | ||
53 | } | ||
54 | }, | ||
55 | |||
56 | _spans:{ | ||
57 | value:[] | ||
58 | }, | ||
59 | |||
60 | spans:{ | ||
61 | serializable:true, | ||
62 | get:function () { | ||
63 | return this._spans; | ||
64 | }, | ||
65 | set:function (newVal) { | ||
66 | this._spans = newVal; | ||
67 | } | ||
68 | }, | ||
69 | |||
70 | _spanRepetition:{ | ||
71 | value:null | ||
72 | }, | ||
73 | |||
74 | spanRepetition:{ | ||
75 | get:function () { | ||
76 | return this._spanRepetition; | ||
77 | }, | ||
78 | set:function (newVal) { | ||
79 | this._spanRepetition = newVal; | ||
80 | } | ||
81 | }, | ||
82 | |||
83 | trackDuration:{ | ||
84 | value:0 | ||
85 | }, | ||
86 | |||
87 | currentKeyframe:{ | ||
88 | value:0 | ||
89 | }, | ||
90 | |||
91 | currentMillisecClicked:{ | ||
92 | value: 0 | ||
93 | }, | ||
94 | |||
95 | isAnimated:{ | ||
96 | value:false | ||
97 | }, | ||
98 | |||
99 | animatedElement:{ | ||
100 | value:null | ||
101 | }, | ||
102 | |||
103 | ninjaStylesContoller:{ | ||
104 | value: null | ||
105 | }, | ||
106 | |||
107 | //TEMP | ||
108 | keyFrames:{ | ||
109 | serializable: true, | ||
110 | value:[] | ||
111 | }, | ||
112 | |||
113 | prepareForDraw: { | ||
114 | value: function() { | ||
115 | this.keyFrames = new Array(); | ||
116 | this.spans = new Array(); | ||
117 | this.track_lane.addEventListener("click", this, false); | ||
118 | this.addNewEndPoint(0); | ||
119 | |||
120 | this.ninjaStylesContoller = this.application.ninja.stylesController; | ||
121 | } | ||
122 | }, | ||
123 | |||
124 | handleNewTween:{ | ||
125 | value: function(event){ | ||
126 | var newTween = Tween.create(); | ||
127 | } | ||
128 | }, | ||
129 | |||
130 | handleClick:{ | ||
131 | value:function (ev) { | ||
132 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | ||
133 | this.currentMillisecClicked = currentMillisecPerPixel * (ev.offsetX + parseInt(ev.target.style.left)); | ||
134 | |||
135 | // TEMP - if the SHIFT key is down, add a new keyframe or split an existing span | ||
136 | // This needs to move to a keyboard shortcut that is TBD | ||
137 | if (ev.shiftKey) { | ||
138 | var prevFrame = this.keyFrames[this.keyFrames.length - 1][0]; | ||
139 | if (ev.offsetX > prevFrame) { | ||
140 | this.addNewEndPoint(ev.offsetX); | ||
141 | this.currentMillisecClicked = currentMillisecPerPixel * ev.offsetX; | ||
142 | } else { | ||
143 | this.currentMillisecClicked = currentMillisecPerPixel * (ev.offsetX + parseInt(ev.target.style.left)); | ||
144 | this.splitSpan(ev); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | console.log("currentMillisecClicked = " + this.currentMillisecClicked); | ||
149 | } | ||
150 | }, | ||
151 | |||
152 | addNewEndPoint : { | ||
153 | value: function(xpos){ | ||
154 | var newKeyFrame = document.createElement("div"); | ||
155 | newKeyFrame.className = "keyframe"; | ||
156 | newKeyFrame.style.left = (xpos - 2) + "px"; | ||
157 | this.track_lane.appendChild(newKeyFrame); | ||
158 | |||
159 | if(xpos > 0){ | ||
160 | var prevFrame = this.keyFrames[this.keyFrames.length - 1][0]; | ||
161 | |||
162 | var newDefaultSpan = document.createElement("div"); | ||
163 | newDefaultSpan.className = "defaultSpan"; | ||
164 | newDefaultSpan.style.left = prevFrame + "px"; | ||
165 | newDefaultSpan.style.width = (xpos - prevFrame) + "px"; | ||
166 | this.track_lane.appendChild(newDefaultSpan); | ||
167 | |||
168 | this.spans.push(newDefaultSpan); | ||
169 | } | ||
170 | |||
171 | var keyframePercent = this.currentMillisecClicked / this.application.ninja.timeline.totalDuration; | ||
172 | var keyframeProperties; | ||
173 | |||
174 | //console.log(keyframePercent); | ||
175 | |||
176 | this.keyFrames.push([xpos, keyframePercent, keyframeProperties]); | ||
177 | //console.log(this.keyFrames) | ||
178 | } | ||
179 | }, | ||
180 | |||
181 | splitSpan: { | ||
182 | value: function(ev){ | ||
183 | console.log("splitting span at span offsetX: " + ev.offsetX); | ||
184 | |||
185 | //this.track_lane.removeChild(ev.target); | ||
186 | } | ||
187 | }, | ||
188 | |||
189 | updateKeyframePercents:{ | ||
190 | value:function(){ | ||
191 | |||
192 | } | ||
193 | }, | ||
194 | |||
195 | addAnimationRuleToElement:{ | ||
196 | value: function(){ | ||
197 | |||
198 | } | ||
199 | }, | ||
200 | |||
201 | calculateKeyframePercent:{ | ||
202 | value:function() { | ||
203 | |||
204 | } | ||
205 | }, | ||
206 | |||
207 | buildKeyframesString:{ | ||
208 | value:function(){ | ||
209 | |||
210 | } | ||
211 | } | ||
212 | }); | ||