diff options
author | Jonathan Duran | 2012-06-20 15:04:45 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-06-20 15:04:45 -0700 |
commit | c6ae80c488621d4ac189cb63309b6258115f823a (patch) | |
tree | dfa26112e1830972fcb212bbb5b17c9a901c645f /node_modules/montage/ui/composer | |
parent | 022e714cb5d10cd8575ab9907eddfb184a990b66 (diff) | |
parent | c9852665eadc1acb9c1c881d207c4bd9ef88805f (diff) | |
download | ninja-c6ae80c488621d4ac189cb63309b6258115f823a.tar.gz |
Merge branch 'refs/heads/NINJAmaster' into Timeline-merge-candidate
Diffstat (limited to 'node_modules/montage/ui/composer')
-rw-r--r-- | node_modules/montage/ui/composer/key-composer.js | 16 | ||||
-rw-r--r-- | node_modules/montage/ui/composer/press-composer.js | 52 | ||||
-rw-r--r-- | node_modules/montage/ui/composer/translate-composer.js | 2 |
3 files changed, 44 insertions, 26 deletions
diff --git a/node_modules/montage/ui/composer/key-composer.js b/node_modules/montage/ui/composer/key-composer.js index 9d2c0f14..015ab115 100644 --- a/node_modules/montage/ui/composer/key-composer.js +++ b/node_modules/montage/ui/composer/key-composer.js | |||
@@ -103,9 +103,9 @@ var KeyComposer = exports.KeyComposer = Montage.create(Composer, /** @lends modu | |||
103 | @default null | 103 | @default null |
104 | */ | 104 | */ |
105 | identifier: { | 105 | identifier: { |
106 | get: function() { | 106 | get: function() { |
107 | return this._identifier; | 107 | return this._identifier; |
108 | }, | 108 | }, |
109 | set: function(identifier) { | 109 | set: function(identifier) { |
110 | this._identifier = identifier; | 110 | this._identifier = identifier; |
111 | } | 111 | } |
@@ -234,7 +234,7 @@ var KeyComposer = exports.KeyComposer = Montage.create(Composer, /** @lends modu | |||
234 | this._keyRegistered = true; | 234 | this._keyRegistered = true; |
235 | } | 235 | } |
236 | } else if (component && typeof component.addComposer !== "function") { | 236 | } else if (component && typeof component.addComposer !== "function") { |
237 | // this keyComposer is associated with an element, let's make it a global key | 237 | // this keyComposer is not associated with an element, let's make it a global key |
238 | if (!this.element) { | 238 | if (!this.element) { |
239 | this.element = window; | 239 | this.element = window; |
240 | } | 240 | } |
@@ -264,11 +264,15 @@ var KeyComposer = exports.KeyComposer = Montage.create(Composer, /** @lends modu | |||
264 | value: function() { | 264 | value: function() { |
265 | var component = this.component; | 265 | var component = this.component; |
266 | 266 | ||
267 | if (this.identifier === null) { | ||
268 | this.identifier = Montage.getInfoForObject(this).label; | ||
269 | } | ||
270 | |||
267 | if (component) { | 271 | if (component) { |
268 | if (typeof component.addComposer == "function") { | 272 | if (typeof component.addComposer == "function") { |
269 | component.addComposer(this); | 273 | component.addComposer(this); |
270 | } else if (!this._isLoaded) { | 274 | } else if (!this._isLoaded) { |
271 | // this keyComposer is associated with an element, let's make it a global key | 275 | // this keyComposer is not associated with an element, let's make it a global key |
272 | if (!this.element) { | 276 | if (!this.element) { |
273 | this.element = window; | 277 | this.element = window; |
274 | } | 278 | } |
@@ -284,7 +288,7 @@ var KeyComposer = exports.KeyComposer = Montage.create(Composer, /** @lends modu | |||
284 | /** | 288 | /** |
285 | @class KeyManagerProxy | 289 | @class KeyManagerProxy |
286 | @classdesc Provide a proxy for lazy load of module:montage/core/event/key-manager.KeyManager. | 290 | @classdesc Provide a proxy for lazy load of module:montage/core/event/key-manager.KeyManager. |
287 | @extends module:montage | 291 | @extends module:montage/core/core.Montage |
288 | @private | 292 | @private |
289 | */ | 293 | */ |
290 | var _keyManagerProxy= null; | 294 | var _keyManagerProxy= null; |
diff --git a/node_modules/montage/ui/composer/press-composer.js b/node_modules/montage/ui/composer/press-composer.js index d71d2ec6..55903b5f 100644 --- a/node_modules/montage/ui/composer/press-composer.js +++ b/node_modules/montage/ui/composer/press-composer.js | |||
@@ -58,9 +58,9 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m | |||
58 | load: { | 58 | load: { |
59 | value: function() { | 59 | value: function() { |
60 | if (window.Touch) { | 60 | if (window.Touch) { |
61 | this._element.addEventListener("touchstart", this); | 61 | this._element.addEventListener("touchstart", this, true); |
62 | } else { | 62 | } else { |
63 | this._element.addEventListener("mousedown", this); | 63 | this._element.addEventListener("mousedown", this, true); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | }, | 66 | }, |
@@ -76,6 +76,19 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m | |||
76 | }, | 76 | }, |
77 | 77 | ||
78 | /** | 78 | /** |
79 | Delegate that implements <code>surrenderPointer</code>. See Component for | ||
80 | explanation of what this method should do. | ||
81 | |||
82 | @type {Object} | ||
83 | @default null | ||
84 | */ | ||
85 | delegate: { | ||
86 | serializable: true, | ||
87 | value: null | ||
88 | }, | ||
89 | |||
90 | |||
91 | /** | ||
79 | Cancel the current press. | 92 | Cancel the current press. |
80 | 93 | ||
81 | Can be used in a "longPress" event handler to prevent the "press" event | 94 | Can be used in a "longPress" event handler to prevent the "press" event |
@@ -191,16 +204,16 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m | |||
191 | return false; | 204 | return false; |
192 | } | 205 | } |
193 | 206 | ||
194 | document.addEventListener("touchend", this); | 207 | document.addEventListener("touchend", this, false); |
195 | document.addEventListener("touchcancel", this); | 208 | document.addEventListener("touchcancel", this, false); |
196 | } else if (event.type === "mousedown") { | 209 | } else if (event.type === "mousedown") { |
197 | this._observedPointer = "mouse"; | 210 | this._observedPointer = "mouse"; |
198 | // Needed to cancel action event dispatch is mouseup'd when | 211 | // Needed to cancel action event dispatch is mouseup'd when |
199 | // not on the component | 212 | // not on the component |
200 | document.addEventListener("mouseup", this); | 213 | document.addEventListener("mouseup", this, false); |
201 | // Needed to preventDefault if another component has claimed | 214 | // Needed to preventDefault if another component has claimed |
202 | // the pointer | 215 | // the pointer |
203 | document.addEventListener("click", this); | 216 | document.addEventListener("click", this, false); |
204 | } | 217 | } |
205 | 218 | ||
206 | this.component.eventManager.claimPointer(this._observedPointer, this); | 219 | this.component.eventManager.claimPointer(this._observedPointer, this); |
@@ -239,18 +252,19 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m | |||
239 | // in surrenderPointer, just end the interaction. | 252 | // in surrenderPointer, just end the interaction. |
240 | this._endInteraction(event); | 253 | this._endInteraction(event); |
241 | return; | 254 | return; |
242 | } | 255 | } else if (event.type === "mouseup") { |
243 | |||
244 | if (!isSurrendered && isTarget && event.type === "mouseup") { | ||
245 | this._dispatchPress(event); | ||
246 | this._endInteraction(event); | ||
247 | return; | ||
248 | } | ||
249 | 256 | ||
250 | if (!isSurrendered && !isTarget && event.type === "mouseup") { | 257 | if (!isSurrendered && isTarget) { |
251 | this._dispatchPressCancel(event); | 258 | this._dispatchPress(event); |
252 | this._endInteraction(event); | 259 | this._endInteraction(event); |
253 | return; | 260 | return; |
261 | } else if (!isSurrendered && !isTarget) { | ||
262 | this._dispatchPressCancel(event); | ||
263 | this._endInteraction(event); | ||
264 | return; | ||
265 | } else if (isSurrendered && !isTarget) { | ||
266 | this._endInteraction(event); | ||
267 | } | ||
254 | } | 268 | } |
255 | } | 269 | } |
256 | }, | 270 | }, |
@@ -319,7 +333,7 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m | |||
319 | 333 | ||
320 | // Handlers | 334 | // Handlers |
321 | 335 | ||
322 | handleTouchstart: { | 336 | captureTouchstart: { |
323 | value: function(event) { | 337 | value: function(event) { |
324 | this._startInteraction(event); | 338 | this._startInteraction(event); |
325 | } | 339 | } |
@@ -352,7 +366,7 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m | |||
352 | } | 366 | } |
353 | }, | 367 | }, |
354 | 368 | ||
355 | handleMousedown: { | 369 | captureMousedown: { |
356 | value: function(event) { | 370 | value: function(event) { |
357 | this._startInteraction(event); | 371 | this._startInteraction(event); |
358 | } | 372 | } |
diff --git a/node_modules/montage/ui/composer/translate-composer.js b/node_modules/montage/ui/composer/translate-composer.js index 78459b9d..f82ca393 100644 --- a/node_modules/montage/ui/composer/translate-composer.js +++ b/node_modules/montage/ui/composer/translate-composer.js | |||
@@ -622,7 +622,7 @@ var TranslateComposer = exports.TranslateComposer = Montage.create(Composer,/** | |||
622 | captureTouchend: { | 622 | captureTouchend: { |
623 | value: function(event) { | 623 | value: function(event) { |
624 | var i = 0, len = event.changedTouches.length; | 624 | var i = 0, len = event.changedTouches.length; |
625 | while (i < len && !this.eventManager.isPointerClaimedByComponent(event.changedTouches[i].identifier, this)) { | 625 | while (i < len && event.changedTouches[i].identifier !== this._observedPointer) { |
626 | i++; | 626 | i++; |
627 | } | 627 | } |
628 | if (i < len) { | 628 | if (i < len) { |