diff options
author | Valerio Virgillito | 2012-02-16 22:08:04 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-16 22:08:04 -0800 |
commit | 0175cb67e426a27a3ecfb7b81317caa383c8a5a5 (patch) | |
tree | b4fbfcaabaadff508ad5463e8f71fd643995aacb /node_modules/montage/ui | |
parent | fe71cb9aa1700199c0089166ad54fc56eb760644 (diff) | |
parent | 9f0c4efe2ed9a00f2c5d85c9d88a8040fedb5d8f (diff) | |
download | ninja-0175cb67e426a27a3ecfb7b81317caa383c8a5a5.tar.gz |
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'node_modules/montage/ui')
33 files changed, 935 insertions, 1020 deletions
diff --git a/node_modules/montage/ui/bluemoon/progress.reel/progress.html b/node_modules/montage/ui/bluemoon/progress.reel/progress.html index 025847e7..025847e7 100755..100644 --- a/node_modules/montage/ui/bluemoon/progress.reel/progress.html +++ b/node_modules/montage/ui/bluemoon/progress.reel/progress.html | |||
diff --git a/node_modules/montage/ui/button.reel/button.js b/node_modules/montage/ui/button.reel/button.js index 51f4c011..5da92482 100644 --- a/node_modules/montage/ui/button.reel/button.js +++ b/node_modules/montage/ui/button.reel/button.js | |||
@@ -3,11 +3,13 @@ | |||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<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. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | /*global require, exports*/ | ||
6 | var Montage = require("montage").Montage, | 7 | var Montage = require("montage").Montage, |
7 | Component = require("ui/component").Component, | 8 | Component = require("ui/component").Component, |
8 | NativeControl = require("ui/native-control").NativeControl; | 9 | NativeControl = require("ui/native-control").NativeControl, |
10 | PressComposer = require("ui/composer/press-composer").PressComposer; | ||
9 | /** | 11 | /** |
10 | * The Text input | 12 | * The Button input |
11 | */ | 13 | */ |
12 | var Button = exports.Button = Montage.create(NativeControl, { | 14 | var Button = exports.Button = Montage.create(NativeControl, { |
13 | 15 | ||
@@ -127,56 +129,25 @@ var Button = exports.Button = Montage.create(NativeControl, { | |||
127 | } | 129 | } |
128 | }, | 130 | }, |
129 | 131 | ||
130 | // Low-level event listeners | 132 | prepareForActivationEvents: { |
131 | 133 | value: function() { | |
132 | /** | 134 | var pressComposer = PressComposer.create(); |
133 | Description TODO | 135 | this.addComposer(pressComposer); |
134 | @function | 136 | pressComposer.addEventListener("pressstart", this, false); |
135 | @param {Event} event The handleMousedown event | 137 | pressComposer.addEventListener("press", this, false); |
136 | */ | 138 | pressComposer.addEventListener("presscancel", this, false); |
137 | handleMousedown: { | ||
138 | value: function(event) { | ||
139 | if (this._observedPointer !== null) { | ||
140 | return; | ||
141 | } | ||
142 | if (!this._disabled) { | ||
143 | this._startInteraction("mouse"); | ||
144 | } | ||
145 | |||
146 | event.preventDefault(); | ||
147 | |||
148 | if (!this._preventFocus) { | ||
149 | this._element.focus(); | ||
150 | } | ||
151 | } | ||
152 | }, | ||
153 | /** | ||
154 | Description TODO | ||
155 | @function | ||
156 | @param {Event} event The handleMouseup event | ||
157 | */ | ||
158 | handleMouseup: { | ||
159 | value: function(event) { | ||
160 | this._interpretInteraction(event); | ||
161 | } | 139 | } |
162 | }, | 140 | }, |
163 | 141 | ||
142 | // Handlers | ||
143 | |||
164 | /** | 144 | /** |
165 | Description TODO | 145 | Called when the user starts interacting with the component. |
166 | @function | ||
167 | @param {Event} event The handleTouchstart event | ||
168 | */ | 146 | */ |
169 | handleTouchstart: { | 147 | handlePressstart: { |
170 | value: function(event) { | 148 | value: function(event) { |
171 | if (this._observedPointer !== null) { | 149 | this.active = true; |
172 | return; | ||
173 | } | ||
174 | if (!this._disabled) { | ||
175 | this._startInteraction(event.changedTouches[0].identifier); | ||
176 | } | ||
177 | 150 | ||
178 | // NOTE preventingDefault disables the magnifying class | ||
179 | // sadly it also disables double tapping on the button to zoom... | ||
180 | event.preventDefault(); | 151 | event.preventDefault(); |
181 | 152 | ||
182 | if (!this._preventFocus) { | 153 | if (!this._preventFocus) { |
@@ -184,142 +155,38 @@ var Button = exports.Button = Montage.create(NativeControl, { | |||
184 | } | 155 | } |
185 | } | 156 | } |
186 | }, | 157 | }, |
187 | /** | ||
188 | Description TODO | ||
189 | @function | ||
190 | @param {Event} event The handleTouchend event | ||
191 | */ | ||
192 | handleTouchend: { | ||
193 | value: function(event) { | ||
194 | var i = 0, changedTouchCount = event.changedTouches.length; | ||
195 | |||
196 | for (; i < changedTouchCount; i++) { | ||
197 | if (event.changedTouches[i].identifier === this._observedPointer) { | ||
198 | this._interpretInteraction(event); | ||
199 | return; | ||
200 | } | ||
201 | } | ||
202 | 158 | ||
203 | } | ||
204 | }, | ||
205 | /** | 159 | /** |
206 | Description TODO | 160 | Called when the user has interacted with the button. |
207 | @function | ||
208 | @param {Event} event The handleTouchcancel event | ||
209 | */ | 161 | */ |
210 | handleTouchcancel: { | 162 | handlePress: { |
211 | value: function(event) { | 163 | value: function(event) { |
212 | var i = 0, changedTouchCount = event.changedTouches.length; | 164 | this.active = false; |
213 | 165 | this._dispatchActionEvent(); | |
214 | for (; i < changedTouchCount; i++) { | ||
215 | if (event.changedTouches[i].identifier === this._observedPointer) { | ||
216 | this._endInteraction(); | ||
217 | return; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | } | ||
222 | }, | ||
223 | |||
224 | /** | ||
225 | If we have to surrender the pointer we are no longer active. This will | ||
226 | stop the action event being dispatched. | ||
227 | */ | ||
228 | surrenderPointer: { | ||
229 | value: function(pointer, component) { | ||
230 | if (pointer === this._observedPointer) { | ||
231 | this._endInteraction(); | ||
232 | } | ||
233 | return true; | ||
234 | } | 166 | } |
235 | }, | 167 | }, |
236 | 168 | ||
237 | // Internal state management | ||
238 | |||
239 | /** | ||
240 | Stores the pointer that pressed down the button. Needed for multitouch. | ||
241 | @private | ||
242 | */ | ||
243 | _observedPointer: { | ||
244 | enumerable: true, | ||
245 | value: null | ||