diff options
author | Valerio Virgillito | 2012-02-01 00:09:27 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-01 00:09:27 -0800 |
commit | 8592cfb89db05f0e52d8c1b8c7046e6f49e3522d (patch) | |
tree | a6f9b5adfe16fd6232708f8a2345cd79056caca9 /node_modules/montage-user/ui/flow-path.js | |
parent | c6d1a1da9e7cdf477daf32410d80691eb1e828d5 (diff) | |
download | ninja-8592cfb89db05f0e52d8c1b8c7046e6f49e3522d.tar.gz |
Adding a montage framework copy for the user document
Adding a new montage copy containing the latest version of montage to use the new native widgets
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage-user/ui/flow-path.js')
-rw-r--r-- | node_modules/montage-user/ui/flow-path.js | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/node_modules/montage-user/ui/flow-path.js b/node_modules/montage-user/ui/flow-path.js new file mode 100644 index 00000000..ecb1d8fa --- /dev/null +++ b/node_modules/montage-user/ui/flow-path.js | |||
@@ -0,0 +1,209 @@ | |||
1 | var Montage = require("montage").Montage; | ||
2 | |||
3 | var FlowPath = exports.FlowPath = Montage.create(Montage, { | ||
4 | |||
5 | _translateX: { | ||
6 | enumerable: false, | ||
7 | value: null | ||
8 | }, | ||
9 | translateX: { | ||
10 | get: function () { | ||
11 | return this._translateX; | ||
12 | }, | ||
13 | set: function (value) { | ||
14 | this._translateX = value; | ||
15 | this._updatePath(); | ||
16 | } | ||
17 | }, | ||
18 | |||
19 | _translateY: { | ||
20 | enumerable: false, | ||
21 | value: null | ||
22 | }, | ||
23 | translateY: { | ||
24 | get: function () { | ||
25 | return this._translateY; | ||
26 | }, | ||
27 | set: function (value) { | ||
28 | this._translateY = value; | ||
29 | this._updatePath(); | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | _translateZ: { | ||
34 | enumerable: false, | ||
35 | value: null | ||
36 | }, | ||
37 | translateZ: { | ||
38 | get: function () { | ||
39 | return this._translateZ; | ||
40 | }, | ||
41 | set: function (value) { | ||
42 | this._translateZ = value; | ||
43 | this._updatePath(); | ||
44 | } | ||
45 | }, | ||
46 | |||
47 | _rotateX: { | ||
48 | enumerable: false, | ||
49 | value: null | ||
50 | }, | ||
51 | rotateX: { | ||
52 | get: function () { | ||
53 | return this._rotateX; | ||
54 | }, | ||
55 | set: function (value) { | ||
56 | this._rotateX = value; | ||
57 | this._updatePath(); | ||
58 | } | ||
59 | }, | ||
60 | |||
61 | _rotateY: { | ||
62 | enumerable: false, | ||
63 | value: null | ||
64 | }, | ||
65 | rotateY: { | ||
66 | get: function () { | ||
67 | return this._rotateY; | ||
68 | }, | ||
69 | set: function (value) { | ||
70 | this._rotateY = value; | ||
71 | this._updatePath(); | ||
72 | } | ||
73 | }, | ||
74 | |||
75 | _rotateZ: { | ||
76 | enumerable: false, | ||
77 | value: null | ||
78 | }, | ||
79 | rotateZ: { | ||
80 | get: function () { | ||
81 | return this._rotateZ; | ||
82 | }, | ||
83 | set: function (value) { | ||
84 | this._rotateZ = value; | ||
85 | this._updatePath(); | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | _scale: { | ||
90 | enumerable: false, | ||
91 | value: null | ||
92 | }, | ||
93 | scale: { | ||
94 | get: function () { | ||
95 | return this._scale; | ||
96 | }, | ||
97 | set: function (value) { | ||
98 | this._scale = value; | ||
99 | this._updatePath(); | ||
100 | } | ||
101 | }, | ||
102 | |||
103 | _opacity: { | ||
104 | enumerable: false, | ||
105 | value: null | ||
106 | }, | ||
107 | opacity: { | ||
108 | get: function () { | ||
109 | return this._opacity; | ||
110 | }, | ||
111 | set: function (value) { | ||
112 | this._opacity = value; | ||
113 | this._updatePath(); | ||
114 | } | ||
115 | }, | ||
116 | |||
117 | _updatePath: { | ||
118 | enumerable: false, | ||
119 | value: function () { | ||
120 | var path = []; | ||
121 | |||
122 | if (this._translateX) { | ||
123 | path.push("path.translateX="+this._translateX); | ||
124 | } | ||
125 | if (this._translateY) { | ||
126 | path.push("path.translateY="+this._translateY); | ||
127 | } | ||
128 | if (this._translateZ) { | ||
129 | path.push("path.translateZ="+this._translateZ); | ||
130 | } | ||
131 | if (this._rotateX) { | ||
132 | path.push("path.rotateX="+this._rotateX); | ||
133 | } | ||
134 | if (this._rotateY) { | ||
135 | path.push("path.rotateY="+this._rotateY); | ||
136 | } | ||
137 | if (this._rotateZ) { | ||
138 | path.push("path.rotateZ="+this._rotateZ); | ||
139 | } | ||
140 | if (this._scale) { | ||
141 | path.push("path.scale="+this._scale); | ||
142 | } | ||
143 | if (this._opacity) { | ||
144 | path.push("path.style.opacity="+this._opacity); | ||
145 | } | ||
146 | this.evalPath=path; | ||
147 | } | ||
148 | }, | ||
149 | |||
150 | // we should be cautious with this eval, but I wanted to try serializing paths directly | ||
151 | |||
152 | _evalPath: { | ||
153 | enumerable: false, | ||
154 | value: null | ||
155 | }, | ||
156 | |||
157 | evalPath: { | ||
158 | get: function () { | ||
159 | return this._evalPath; | ||
160 | }, | ||
161 | set: function (value) { | ||
162 | var error=false; | ||
163 | |||
164 | if (typeof value === "string") { | ||
165 | try { | ||
166 | eval("var func=function(slide){var path={};path.style={};"+value+";return path;}"); | ||
167 | func({ | ||
168 | time:0, | ||
169 | speed:0, | ||
170 | index:0 | ||
171 | }); | ||
172 | } catch (e) { | ||
173 | error=true; | ||
174 | } | ||
175 | if (!error) { | ||
176 | this._evalPath = value; | ||
177 | } | ||
178 | } else { | ||
179 | this._evalPath = value.join(";\r\n")+";"; | ||
180 | eval("var func=function(slide){var path={};path.style={};"+this._evalPath+"return path;}"); | ||
181 | } | ||
182 | |||
183 | if (!error) { | ||
184 | this.path = { | ||
185 | value: func | ||
186 | }; | ||
187 | } | ||
188 | } | ||
189 | }, | ||
190 | |||
191 | _path: { | ||
192 | enumerable: false, | ||
193 | value: { | ||
194 | value: function (slide) { | ||
195 | return {}; | ||
196 | } | ||
197 | } | ||
198 | }, | ||
199 | |||
200 | path: { | ||
201 | get: function () { | ||
202 | return this._path; | ||
203 | }, | ||
204 | set: function (value) { | ||
205 | this._path = value; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | }); | ||