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