aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ninja-components/flow-controller.reel/flow-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ninja-components/flow-controller.reel/flow-controller.js')
-rw-r--r--node_modules/ninja-components/flow-controller.reel/flow-controller.js288
1 files changed, 288 insertions, 0 deletions
diff --git a/node_modules/ninja-components/flow-controller.reel/flow-controller.js b/node_modules/ninja-components/flow-controller.reel/flow-controller.js
new file mode 100644
index 00000000..0ce12473
--- /dev/null
+++ b/node_modules/ninja-components/flow-controller.reel/flow-controller.js
@@ -0,0 +1,288 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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").Montage,
8 Component = require("ui/component").Component;
9
10exports.FlowController = Montage.create(Component, {
11
12 templateDidLoad: {
13 value: function() {
14// this.spacing = this.offsetController.scale;
15// this.animation = this.path2;
16// this.hasMomentum = this.scrollController.hasMomentum;
17 }
18 },
19
20 scrollController: {
21 enumerable: true,
22 serializable: true,
23 value: null
24 },
25
26 offsetController: {
27 enumerable: true,
28 serializable: true,
29 value: null
30 },
31
32 flowComponent: {
33 enumerable: true,
34 serializable: true,
35 value: null
36 },
37
38
39
40 // ------------------------------------------------------------------------
41 // Forwarding these properties to their equivalents in Scroll
42 _speed: {
43 enumerable: true,
44 serializable: true,
45 value: 1
46 },
47
48 speed: {
49 get: function() {
50 return this._speed;
51 },
52 set: function(value) {
53 if(this._speed !== value)
54 {
55 if( this.scrollController && (this.scrollController.pointerSpeedMultiplier !== value) )
56 {
57 this._speed = value;
58 this.scrollController.pointerSpeedMultiplier = value;
59 this.needsDraw = true;
60 }
61 }
62 }
63 },
64
65 hasMomentum: {
66 get: function() {
67 if(this.scrollController)
68 {
69 return this.scrollController.hasMomentum;
70 }
71 },
72 set: function(value) {
73 if( this.scrollController && (this.scrollController.hasMomentum !== value) )
74 {
75 this.scrollController.hasMomentum = value;
76 this.needsDraw = true;
77 }
78 }
79 },
80
81 hasBouncing: {
82 get: function() {
83 if(this.scrollController)
84 {
85 return this.scrollController.hasBouncing;
86 }
87 },
88 set: function(value) {
89 if( this.scrollController && (this.scrollController.hasBouncing !== value) )
90 {
91 this.scrollController.hasBouncing = value;
92 this.needsDraw = true;
93 }
94 }
95 },
96
97 momentumDuration: {
98 get: function() {
99 if(this.scrollController)
100 {
101 return this.scrollController.momentumDuration;
102 }
103 },
104 set: function(value) {
105 if( this.scrollController && (this.scrollController.momentumDuration !== value) )
106 {
107 this.scrollController.momentumDuration = value;
108 this.needsDraw = true;
109 }
110 }
111 },
112
113 bouncingDuration: {
114 get: function() {
115 if(this.scrollController)
116 {
117 return this.scrollController.bouncingDuration;
118 }
119 },
120 set: function(value) {
121 if( this.scrollController && (this.scrollController.bouncingDuration !== value) )
122 {
123 this.scrollController.bouncingDuration = value;
124 this.needsDraw = true;
125 }
126 }
127 },
128 // ------------------------------------------------------------------------
129
130
131
132 // ------------------------------------------------------------------------
133 // Forwarding these properties to their equivalents in FlowOffset
134 _spacing: {
135 enumerable: true,
136 serializable: true,
137 value: 350
138 },
139
140 spacing: {
141 get: function() {
142 return this._spacing;
143 },
144 set: function(scale) {
145// if( this.offsetController && (this.offsetController.scale !== scale) )
146// {
147// this.offsetController.scale = scale;
148// this.needsDraw = true;
149// }
150 if(this._spacing !== scale)
151 {
152 if( this.offsetController && (this.offsetController.scale !== scale) )
153 {
154 this._spacing = scale;
155 this.offsetController.scale = scale;
156 this.needsDraw = true;
157 }
158 }
159 }
160 },
161 // ------------------------------------------------------------------------
162
163
164
165 // ------------------------------------------------------------------------
166 // Some paths definitions and necessary values
167 interpValue: {
168 enumerable: true,
169 serializable: true,
170 value: 1
171 },
172
173 slideShow: {
174 value: {
175 value: function (slide) {
176 var path={
177 translateX: 10+slide.time
178 };
179 return path;
180 }
181 }
182 },
183 // ------------------------------------------------------------------------
184
185
186
187 // ------------------------------------------------------------------------
188 // Forwarding these properties to their equivalents in Flow
189
190 // TODO - hard-coding values for demo
191 _src: {
192 enumerable: true,
193 serializable: true,
194 value: ""
195 },
196
197 src: {
198 get: function() {
199 return this._src;
200 },
201 set: function(value) {
202 this.images = this.imagesForDemo;
203 this._src = "images";
204 this.needsDraw = true;
205 }
206 },
207
208 images: {