Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: samples/swipe/web/swipe.dart

Issue 12493003: Exposing Point & Rect types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sync to ToT Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/swarm/swarm_ui_lib/touch/TouchUtil.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library swipe; 5 library swipe;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:math'; 9 import 'dart:math';
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 initialize3D(); 22 initialize3D();
23 23
24 // Handle touch events. 24 // Handle touch events.
25 int touchStartX; 25 int touchStartX;
26 26
27 target.onTouchStart.listen((TouchEvent event) { 27 target.onTouchStart.listen((TouchEvent event) {
28 event.preventDefault(); 28 event.preventDefault();
29 29
30 if (event.touches.length > 0) { 30 if (event.touches.length > 0) {
31 touchStartX = event.touches[0].pageX; 31 touchStartX = event.touches[0].page.x;
32 } 32 }
33 }); 33 });
34 34
35 target.onTouchMove.listen((TouchEvent event) { 35 target.onTouchMove.listen((TouchEvent event) {
36 event.preventDefault(); 36 event.preventDefault();
37 37
38 if (touchStartX != null && event.touches.length > 0) { 38 if (touchStartX != null && event.touches.length > 0) {
39 int newTouchX = event.touches[0].pageX; 39 int newTouchX = event.touches[0].page.x;
40 40
41 if (newTouchX > touchStartX) { 41 if (newTouchX > touchStartX) {
42 spinFigure(target, (newTouchX - touchStartX) ~/ 20 + 1); 42 spinFigure(target, (newTouchX - touchStartX) ~/ 20 + 1);
43 touchStartX = null; 43 touchStartX = null;
44 } else if (newTouchX < touchStartX) { 44 } else if (newTouchX < touchStartX) {
45 spinFigure(target, (newTouchX - touchStartX) ~/ 20 - 1); 45 spinFigure(target, (newTouchX - touchStartX) ~/ 20 - 1);
46 touchStartX = null; 46 touchStartX = null;
47 } 47 }
48 } 48 }
49 }); 49 });
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 /** 121 /**
122 * Stop any spin that may be in progress. 122 * Stop any spin that may be in progress.
123 */ 123 */
124 void stopSpin() { 124 void stopSpin() {
125 if (timer != null) { 125 if (timer != null) {
126 timer.cancel(); 126 timer.cancel();
127 timer = null; 127 timer = null;
128 } 128 }
129 } 129 }
OLDNEW
« no previous file with comments | « samples/swarm/swarm_ui_lib/touch/TouchUtil.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698