diff options
author | Valerio Virgillito | 2012-04-18 13:48:51 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-18 13:48:51 -0700 |
commit | 2e04af953463643791f6362bd8ef4c6ba190abfa (patch) | |
tree | d07aaf646091ddf9dad5b030a7905055fd323490 /node_modules/montage/ui/composer | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-2e04af953463643791f6362bd8ef4c6ba190abfa.tar.gz |
Squashed commit of the following:
commit 2054551bfb01a0f4ca2e138b9d724835462d45cd
Merge: 765c2da 616a853
Author: Valerio Virgillito <valerio@motorola.com>
Date: Wed Apr 18 13:48:21 2012 -0700
Merge branch 'refs/heads/master' into integration
commit 765c2da8e1aa03550caf42b2bd5f367555ad2843
Author: Valerio Virgillito <valerio@motorola.com>
Date: Tue Apr 17 15:29:41 2012 -0700
updating the picasa carousel
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
commit 9484f1c82b81e27edf2dc0a1bcc1fa3b12077406
Merge: d27f2df cacb4a2
Author: Valerio Virgillito <valerio@motorola.com>
Date: Tue Apr 17 15:03:50 2012 -0700
Merge branch 'refs/heads/master' into integration
commit d27f2df4d846064444263d7832d213535962abe7
Author: Valerio Virgillito <valerio@motorola.com>
Date: Wed Apr 11 10:39:36 2012 -0700
integrating new picasa carousel component
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
commit 6f98384c9ecbc8abe55ccfe1fc25a0c7ce22c493
Author: Valerio Virgillito <valerio@motorola.com>
Date: Tue Apr 10 14:33:00 2012 -0700
fixed the text area case issue
Text area was renamed from TextArea to Textarea
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
commit 1e83e26652266136802bc7af930379c1ecd631a6
Author: Valerio Virgillito <valerio@motorola.com>
Date: Mon Apr 9 22:10:45 2012 -0700
integrating montage v0.8 into ninja.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/composer')
-rw-r--r-- | node_modules/montage/ui/composer/long-press-composer.js | 232 | ||||
-rw-r--r-- | node_modules/montage/ui/composer/press-composer.js | 126 | ||||
-rw-r--r-- | node_modules/montage/ui/composer/translate-composer.js | 133 |
3 files changed, 201 insertions, 290 deletions
diff --git a/node_modules/montage/ui/composer/long-press-composer.js b/node_modules/montage/ui/composer/long-press-composer.js deleted file mode 100644 index 717bb42e..00000000 --- a/node_modules/montage/ui/composer/long-press-composer.js +++ /dev/null | |||
@@ -1,232 +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 | /** | ||
7 | @module montage/ui/composer/long-press-composer | ||
8 | @requires montage | ||
9 | @requires montage/ui/composer/composer | ||
10 | */ | ||
11 | var Montage = require("montage").Montage, | ||
12 | Composer = require("ui/composer/composer").Composer; | ||
13 | /** | ||
14 | @class module:montage/ui/composer/long-press-composer.LongPressComposer | ||
15 | @extends module:montage/ui/composer/composer.Composer | ||
16 | */ | ||
17 | exports.LongPressComposer = Montage.create(Composer,/** @lends module:montage/ui/event/composer/long-press-composer.LongPressComposer# */ { | ||
18 | |||
19 | /** | ||
20 | Description TODO | ||
21 | @private | ||
22 | */ | ||
23 | _motionThreshold: { | ||
24 | value: 10 | ||
25 | }, | ||
26 | /** | ||
27 | Description TODO | ||
28 | @private | ||
29 | */ | ||
30 | _longpressTimeOut: { | ||
31 | value: 1500 | ||
32 | }, | ||
33 | |||
34 | _longPressTimer: { | ||
35 | value: null | ||
36 | }, | ||
37 | |||
38 | _fingerId: { | ||
39 | value: null | ||
40 | }, | ||
41 | |||
42 | _X: { | ||
43 | value: null | ||
44 | }, | ||
45 | |||
46 | _Y: { | ||
47 | value: null | ||
48 | }, | ||
49 | |||
50 | /** | ||
51 | Description TODO | ||
52 | @function | ||
53 | */ | ||
54 | load: { | ||
55 | value: function () { | ||
56 | if (window.Touch) { | ||
57 | this._element.addEventListener("touchstart", this); | ||
58 | this._element.addEventListener("touchmove", this); | ||
59 | this._element.addEventListener("touchend", this); | ||
60 | } else { | ||
61 | this._element.addEventListener("mousedown", this); | ||
62 | } | ||
63 | } | ||
64 | }, | ||
65 | /** | ||
66 | Description TODO | ||
67 | @function | ||
68 | */ | ||
69 | unload: { | ||
70 | value: function () { | ||
71 | if (window.Touch) { | ||
72 | this._element.removeEventListener("touchstart", this); | ||
73 | this._element.removeEventListener("touchmove", this); | ||
74 | this._element.removeEventListener("touchend", this); | ||
75 | } | ||
76 | else { | ||
77 | this._element.removeEventListener("mousedown", this); | ||
78 | } | ||
79 | } | ||
80 | }, | ||
81 | /** | ||
82 | Description TODO | ||
83 | @function | ||
84 | @param {Event} event This event. | ||
85 | */ | ||
86 | handleTouchstart: { | ||
87 | value: function (event) { | ||
88 | var self = this; | ||
89 | /* If two longpress on same target then the first one will be cleared*/ | ||
90 | if (this._longpressTimer) { | ||
91 | clearTimeout(this._longpressTimer); | ||
92 | this._longpressTimer = null; | ||
93 | } | ||
94 | this._fingerId = event.changedTouches[0].identifier; | ||
95 | this._X = event.changedTouches[0].clientX; | ||
96 | this._Y = event.changedTouches[0].clientY; | ||
97 | this._longpressTimer = null; | ||
98 | this._longpressTimer = setTimeout(function () { | ||
99 | // FIXME should be dispatched against something else | ||
100 | self._dispatchLongPress(self._element); | ||
101 | }, this._longpressTimeOut); | ||
102 | } | ||
103 | }, | ||
104 | /** | ||
105 | Description TODO | ||
106 | @function | ||
107 | @param {Event} event This event. | ||
108 | */ | ||
109 | handleTouchmove: { | ||
110 | value: function (event) { | ||
111 | var i, deltaX, deltaY, len; | ||
112 | /* the longpresstimer is checked so that the flushing of the timer occurs only once even though touchmoves are received */ | ||
113 | if (this._longpressTimer) { | ||
114 | len = event.changedTouches.length; | ||
115 | for (i = 0; i < len; i++) { | ||
116 | /*Checked if two fingers on same target and both are moved */ | ||
117 | if (this._fingerId === event.changedTouches[i].identifier) { | ||
118 | deltaX = Math.abs(event.changedTouches[i].clientX - this._X); | ||
119 | deltaY = Math.abs(event.changedTouches[i].clientY - this._Y); | ||
120 | /* Clearing timer only on some considerable motion */ | ||
121 | if (deltaX > this._motionThreshold || deltaY > this._motionThreshold) { | ||
122 | this._clearLongpress(event.currentTarget); | ||
123 | break; | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | }, | ||
130 | /** | ||
131 | Description TODO | ||
132 | @function | ||
133 | @param {Event} event This event. | ||
134 | */ | ||
135 | handleTouchend: { | ||
136 | value: function (event) { | ||
137 | var target = event.currentTarget; | ||
138 | /* longpresstimer checked because end occurs after its move then timer is already cleared. */ | ||
139 | if (this._longpressTimer && this._fingerId === event.changedTouches[0].identifier) { | ||
140 | this._clearLongpress(target); | ||
141 | } | ||
142 | } | ||
143 | }, | ||
144 | /** | ||
145 | Description TODO | ||
146 | @function | ||
147 | @param {Event} event This event. | ||
148 | */ | ||
149 | handleMousedown: { | ||
150 | value: function (event) { | ||
151 | var target = event.currentTarget; | ||
152 | var self = this; | ||
153 | target.addEventListener("mousemove", this); | ||
154 | target.addEventListener("mouseup", this); | ||
155 | target.addEventListener("mouseout", this); | ||
156 | this._fingerId = 0; | ||
157 | this._X = event.clientX; | ||
158 | this._Y = event.clientY; | ||
159 | this._longpressTimer = setTimeout(function () { | ||
160 | self._dispatchLongPress(target); | ||
161 | }, this._longpressTimeOut); | ||
162 | } | ||
163 | }, | ||
164 | /** | ||
165 | Description TODO | ||
166 | @function | ||
167 | @param {Event} event This event. | ||
168 | */ | ||
169 | handleMouseup: { | ||
170 | value: function (event) { | ||
171 | this._clearLongpress(event.currentTarget); | ||
172 | } | ||
173 | }, | ||
174 | /** | ||
175 | Description TODO | ||
176 | @function | ||
177 | @param {Event} event This event. | ||
178 | */ | ||
179 | handleMouseout: { | ||
180 | value: function (event) { | ||
181 | this._clearLongpress(event.currentTarget); | ||
182 | } | ||
183 | }, | ||
184 | /** | ||
185 | Description TODO | ||
186 | @function | ||
187 | @param {Event} event This event. | ||
188 | */ | ||
189 | handleMousemove: { | ||
190 | value: function (event) { | ||
191 | this._clearLongpress(event.currentTarget); | ||
192 | } | ||
193 | }, | ||
194 | /** | ||
195 | Description TODO | ||
196 | @private | ||
197 | */ | ||
198 | _dispatchLongPress: { | ||
199 | value: function (target) { | ||
200 | longPressEvent = document.createEvent("CustomEvent"); | ||
201 | longPressEvent.clientX = this._X; | ||
202 | longPressEvent.clientY = this._Y; | ||
203 | longPressEvent.identifier = this._fingerId; | ||
204 | longPressEvent.initCustomEvent("longpress", true, true, null); | ||
205 | this.dispatchEvent(longPressEvent); | ||
206 | this._clearLongpress(target); |