diff options
author | Ananya Sen | 2012-02-10 16:05:27 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-10 16:05:27 -0800 |
commit | f3dc624fa464a79fd8e8cec1ddd16ed2109bda23 (patch) | |
tree | f716757dab75d7626297893c7f4aca3596d606de /js/panels/Timeline/Track.reel/Track.js | |
parent | c48eeb01bd726895dc577d8b843b2a75883eee07 (diff) | |
download | ninja-f3dc624fa464a79fd8e8cec1ddd16ed2109bda23.tar.gz |
Revert "Merge from /joseeight/ninja-internal/tree/FileIO"
This reverts commit c48eeb01bd726895dc577d8b843b2a75883eee07.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/panels/Timeline/Track.reel/Track.js')
-rw-r--r-- | js/panels/Timeline/Track.reel/Track.js | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/js/panels/Timeline/Track.reel/Track.js b/js/panels/Timeline/Track.reel/Track.js deleted file mode 100644 index a60c7cd1..00000000 --- a/js/panels/Timeline/Track.reel/Track.js +++ /dev/null | |||
@@ -1,186 +0,0 @@ | |||
1 | var Montage = require("montage/core/core").Montage; | ||
2 | var Component = require("montage/ui/component").Component; | ||
3 | var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; | ||
4 | |||
5 | var Track = exports.Track = Montage.create(Component, { | ||
6 | |||
7 | hasTemplate:{ | ||
8 | value: true | ||
9 | }, | ||
10 | |||
11 | _trackID:{ | ||
12 | value:null, | ||
13 | writable:true, | ||
14 | enumerable:true | ||
15 | }, | ||
16 | |||
17 | trackID:{ | ||
18 | get:function(){ | ||
19 | return this._trackID; | ||
20 | }, | ||
21 | set:function(value){ | ||
22 | this._trackID = value; | ||
23 | } | ||
24 | }, | ||
25 | |||
26 | _spans:{ | ||
27 | serializable:true, | ||
28 | value:[] | ||
29 | }, | ||
30 | |||
31 | spans:{ | ||
32 | serializable:true, | ||
33 | get:function () { | ||
34 | return this._spans; | ||
35 | }, | ||
36 | set:function (newVal) { | ||
37 | this._spans = newVal; | ||
38 | } | ||
39 | }, | ||
40 | |||
41 | _spanRepetition:{ | ||
42 | serializable:true, | ||
43 | value:null | ||
44 | }, | ||
45 | |||
46 | spanRepetition:{ | ||
47 | serializable:true, | ||
48 | get:function () { | ||
49 | return this._spanRepetition; | ||
50 | }, | ||
51 | set:function (newVal) { | ||
52 | this._spanRepetition = newVal; | ||
53 | } | ||
54 | }, | ||
55 | |||
56 | trackDuration:{ | ||
57 | value:0 | ||
58 | }, | ||
59 | |||
60 | currentKeyframe:{ | ||
61 | value:0 | ||
62 | }, | ||
63 | |||
64 | currentMillisecClicked:{ | ||
65 | value: 0 | ||
66 | }, | ||
67 | |||
68 | isAnimated:{ | ||
69 | value:false | ||
70 | }, | ||
71 | |||
72 | animatedElement:{ | ||
73 | value:null | ||
74 | }, | ||
75 | |||
76 | ninjaStylesContoller:{ | ||
77 | value: null | ||
78 | }, | ||
79 | |||
80 | //TEMP | ||
81 | keyFrames:{ | ||
82 | value:[], | ||
83 | writable:true, | ||
84 | enumerable:true | ||
85 | }, | ||
86 | |||
87 | prepareForDraw: { | ||
88 | value: function() { | ||
89 | this.keyFrames = new Array(); | ||
90 | this.spans = new Array(); | ||
91 | this.track_lane.addEventListener("click", this, false); | ||
92 | this.addNewEndPoint(0); | ||
93 | |||
94 | this.ninjaStylesContoller = this.application.ninja.stylesController; | ||
95 | } | ||
96 | }, | ||
97 | |||
98 | handleNewTween:{ | ||
99 | value: function(event){ | ||
100 | var newTween = Tween.create(); | ||
101 | } | ||
102 | }, | ||
103 | |||
104 | handleClick:{ | ||
105 | value:function (ev) { | ||
106 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | ||
107 | this.currentMillisecClicked = currentMillisecPerPixel * (ev.offsetX + parseInt(ev.target.style.left)); | ||
108 | |||
109 | // TEMP - if the SHIFT key is down, add a new keyframe or split an existing span | ||
110 | // This needs to move to a keyboard shortcut that is TBD | ||
111 | if (ev.shiftKey) { | ||
112 | var prevFrame = this.keyFrames[this.keyFrames.length - 1][0]; | ||
113 | if (ev.offsetX > prevFrame) { | ||
114 | this.addNewEndPoint(ev.offsetX); | ||
115 | this.currentMillisecClicked = currentMillisecPerPixel * ev.offsetX; | ||
116 | } else { | ||
117 | this.currentMillisecClicked = currentMillisecPerPixel * (ev.offsetX + parseInt(ev.target.style.left)); | ||
118 | this.splitSpan(ev); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | console.log("currentMillisecClicked = " + this.currentMillisecClicked); | ||
123 | } | ||
124 | }, | ||
125 | |||
126 | addNewEndPoint : { | ||
127 | value: function(xpos){ | ||
128 | var newKeyFrame = document.createElement("div"); | ||
129 | newKeyFrame.className = "keyframe"; | ||
130 | newKeyFrame.style.left = (xpos - 2) + "px"; | ||
131 | this.track_lane.appendChild(newKeyFrame); | ||
132 | |||
133 | if(xpos > 0){ | ||
134 | var prevFrame = this.keyFrames[this.keyFrames.length - 1][0]; | ||
135 | |||
136 | var newDefaultSpan = document.createElement("div"); | ||
137 | newDefaultSpan.className = "defaultSpan"; | ||
138 | newDefaultSpan.style.left = prevFrame + "px"; | ||
139 | newDefaultSpan.style.width = (xpos - prevFrame) + "px"; | ||
140 | this.track_lane.appendChild(newDefaultSpan); | ||
141 | |||
142 | this.spans.push(newDefaultSpan); | ||
143 | } | ||
144 | |||
145 | var keyframePercent = this.currentMillisecClicked / this.application.ninja.timeline.totalDuration; | ||
146 | var keyframeProperties; | ||
147 | |||
148 | //console.log(keyframePercent); | ||
149 | |||
150 | this.keyFrames.push([xpos, keyframePercent, keyframeProperties]); | ||
151 | //console.log(this.keyFrames) | ||
152 | } | ||
153 | }, | ||
154 | |||
155 | splitSpan: { | ||
156 | value: function(ev){ | ||
157 | console.log("splitting span at span offsetX: " + ev.offsetX); | ||
158 | |||
159 | //this.track_lane.removeChild(ev.target); | ||
160 | } | ||
161 | }, | ||
162 | |||
163 | updateKeyframePercents:{ | ||
164 | value:function(){ | ||
165 | |||
166 | } | ||
167 | }, | ||
168 | |||
169 | addAnimationRuleToElement:{ | ||
170 | value: function(){ | ||
171 | |||
172 | } | ||
173 | }, | ||
174 | |||
175 | calculateKeyframePercent:{ | ||
176 | value:function() { | ||
177 | |||
178 | } | ||
179 | }, | ||
180 | |||
181 | buildKeyframesString:{ | ||
182 | value:function(){ | ||
183 | |||
184 | } | ||
185 | } | ||
186 | }); \ No newline at end of file | ||