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