OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library fn; | 5 library fn; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 static final Set<String> _registeredEvents = new HashSet<String>(); | 169 static final Set<String> _registeredEvents = new HashSet<String>(); |
170 | 170 |
171 static Map<String, sky.EventListener> _createListeners({ | 171 static Map<String, sky.EventListener> _createListeners({ |
172 EventListener onWheel, | 172 EventListener onWheel, |
173 GestureEventListener onGestureFlingCancel, | 173 GestureEventListener onGestureFlingCancel, |
174 GestureEventListener onGestureFlingStart, | 174 GestureEventListener onGestureFlingStart, |
175 GestureEventListener onGestureScrollStart, | 175 GestureEventListener onGestureScrollStart, |
176 GestureEventListener onGestureScrollUpdate, | 176 GestureEventListener onGestureScrollUpdate, |
177 GestureEventListener onGestureTap, | 177 GestureEventListener onGestureTap, |
| 178 GestureEventListener onGestureTapDown, |
178 PointerEventListener onPointerCancel, | 179 PointerEventListener onPointerCancel, |
179 PointerEventListener onPointerDown, | 180 PointerEventListener onPointerDown, |
180 PointerEventListener onPointerMove, | 181 PointerEventListener onPointerMove, |
181 PointerEventListener onPointerUp, | 182 PointerEventListener onPointerUp, |
182 Map<String, sky.EventListener> custom | 183 Map<String, sky.EventListener> custom |
183 }) { | 184 }) { |
184 var listeners = custom != null ? | 185 var listeners = custom != null ? |
185 new HashMap<String, sky.EventListener>.from(custom) : | 186 new HashMap<String, sky.EventListener>.from(custom) : |
186 new HashMap<String, sky.EventListener>(); | 187 new HashMap<String, sky.EventListener>(); |
187 | 188 |
188 if (onWheel != null) | 189 if (onWheel != null) |
189 listeners['wheel'] = onWheel; | 190 listeners['wheel'] = onWheel; |
190 if (onGestureFlingCancel != null) | 191 if (onGestureFlingCancel != null) |
191 listeners['gestureflingcancel'] = onGestureFlingCancel; | 192 listeners['gestureflingcancel'] = onGestureFlingCancel; |
192 if (onGestureFlingStart != null) | 193 if (onGestureFlingStart != null) |
193 listeners['gestureflingstart'] = onGestureFlingStart; | 194 listeners['gestureflingstart'] = onGestureFlingStart; |
194 if (onGestureScrollStart != null) | 195 if (onGestureScrollStart != null) |
195 listeners['gesturescrollstart'] = onGestureScrollStart; | 196 listeners['gesturescrollstart'] = onGestureScrollStart; |
196 if (onGestureScrollUpdate != null) | 197 if (onGestureScrollUpdate != null) |
197 listeners['gesturescrollupdate'] = onGestureScrollUpdate; | 198 listeners['gesturescrollupdate'] = onGestureScrollUpdate; |
198 if (onGestureTap != null) | 199 if (onGestureTap != null) |
199 listeners['gesturetap'] = onGestureTap; | 200 listeners['gesturetap'] = onGestureTap; |
| 201 if (onGestureTapDown != null) |
| 202 listeners['gesturetapdown'] = onGestureTapDown; |
200 if (onPointerCancel != null) | 203 if (onPointerCancel != null) |
201 listeners['pointercancel'] = onPointerCancel; | 204 listeners['pointercancel'] = onPointerCancel; |
202 if (onPointerDown != null) | 205 if (onPointerDown != null) |
203 listeners['pointerdown'] = onPointerDown; | 206 listeners['pointerdown'] = onPointerDown; |
204 if (onPointerMove != null) | 207 if (onPointerMove != null) |
205 listeners['pointermove'] = onPointerMove; | 208 listeners['pointermove'] = onPointerMove; |
206 if (onPointerUp != null) | 209 if (onPointerUp != null) |
207 listeners['pointerup'] = onPointerUp; | 210 listeners['pointerup'] = onPointerUp; |
208 | 211 |
209 return listeners; | 212 return listeners; |
210 } | 213 } |
211 | 214 |
212 EventTarget(Node content, { | 215 EventTarget(Node content, { |
213 EventListener onWheel, | 216 EventListener onWheel, |
214 GestureEventListener onGestureFlingCancel, | 217 GestureEventListener onGestureFlingCancel, |
215 GestureEventListener onGestureFlingStart, | 218 GestureEventListener onGestureFlingStart, |
216 GestureEventListener onGestureScrollStart, | 219 GestureEventListener onGestureScrollStart, |
217 GestureEventListener onGestureScrollUpdate, | 220 GestureEventListener onGestureScrollUpdate, |
218 GestureEventListener onGestureTap, | 221 GestureEventListener onGestureTap, |
| 222 GestureEventListener onGestureTapDown, |
219 PointerEventListener onPointerCancel, | 223 PointerEventListener onPointerCancel, |
220 PointerEventListener onPointerDown, | 224 PointerEventListener onPointerDown, |
221 PointerEventListener onPointerMove, | 225 PointerEventListener onPointerMove, |
222 PointerEventListener onPointerUp, | 226 PointerEventListener onPointerUp, |
223 Map<String, sky.EventListener> custom | 227 Map<String, sky.EventListener> custom |
224 }) : this.content = content, | 228 }) : this.content = content, |
225 listeners = _createListeners( | 229 listeners = _createListeners( |
226 onWheel: onWheel, | 230 onWheel: onWheel, |
227 onGestureFlingCancel: onGestureFlingCancel, | 231 onGestureFlingCancel: onGestureFlingCancel, |
228 onGestureFlingStart: onGestureFlingStart, | 232 onGestureFlingStart: onGestureFlingStart, |
229 onGestureScrollUpdate: onGestureScrollUpdate, | 233 onGestureScrollUpdate: onGestureScrollUpdate, |
230 onGestureScrollStart: onGestureScrollStart, | 234 onGestureScrollStart: onGestureScrollStart, |
231 onGestureTap: onGestureTap, | 235 onGestureTap: onGestureTap, |
| 236 onGestureTapDown: onGestureTapDown, |
232 onPointerCancel: onPointerCancel, | 237 onPointerCancel: onPointerCancel, |
233 onPointerDown: onPointerDown, | 238 onPointerDown: onPointerDown, |
234 onPointerMove: onPointerMove, | 239 onPointerMove: onPointerMove, |
235 onPointerUp: onPointerUp, | 240 onPointerUp: onPointerUp, |
236 custom: custom | 241 custom: custom |
237 ), | 242 ), |
238 super(key: content._key); | 243 super(key: content._key); |
239 | 244 |
240 void _handleEvent(sky.Event e) { | 245 void _handleEvent(sky.Event e) { |
241 sky.EventListener listener = listeners[e.type]; | 246 sky.EventListener listener = listeners[e.type]; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 767 |
763 _sync(null, _host, null); | 768 _sync(null, _host, null); |
764 assert(_root is sky.Node); | 769 assert(_root is sky.Node); |
765 | 770 |
766 sw.stop(); | 771 sw.stop(); |
767 if (_shouldLogRenderDuration) | 772 if (_shouldLogRenderDuration) |
768 print("Initial build: ${sw.elapsedMicroseconds} microseconds"); | 773 print("Initial build: ${sw.elapsedMicroseconds} microseconds"); |
769 }); | 774 }); |
770 } | 775 } |
771 } | 776 } |
OLD | NEW |