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

Unified Diff: samples-dev/swarm/swarm_ui_lib/touch/TouchHandler.dart

Issue 2868423003: Fix swarm for non-integer Event timeStamps (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples-dev/swarm/swarm_ui_lib/touch/TouchHandler.dart
diff --git a/samples-dev/swarm/swarm_ui_lib/touch/TouchHandler.dart b/samples-dev/swarm/swarm_ui_lib/touch/TouchHandler.dart
index 4b4ac48fa0ac94a0e6be88ee62f6e16170a864a6..a398ec3cce0d7dd771a3f166a4bed00b2b73f125 100644
--- a/samples-dev/swarm/swarm_ui_lib/touch/TouchHandler.dart
+++ b/samples-dev/swarm/swarm_ui_lib/touch/TouchHandler.dart
@@ -167,7 +167,7 @@ class TouchHandler {
*/
void enable([bool capture = false]) {
Function onEnd = (e) {
- _onEnd(e.timeStamp, e);
+ _onEnd(e.timeStamp.toInt(), e);
};
_addEventListeners(_element, (e) {
_onStart(e);
@@ -272,6 +272,7 @@ class TouchHandler {
int clientY = touch.client.y;
int moveX = _lastTouchX - clientX;
int moveY = _lastTouchY - clientY;
+ int timeStamp = e.timeStamp.toInt();
_totalMoveX += moveX.abs();
_totalMoveY += moveY.abs();
_lastTouchX = clientX;
@@ -286,7 +287,7 @@ class TouchHandler {
} else {
_startTouchX = clientX;
_startTouchY = clientY;
- _startTime = e.timeStamp;
+ _startTime = timeStamp;
}
}
if (_dragging) {
@@ -297,12 +298,12 @@ class TouchHandler {
_removeTouchesInWrongDirection(_recentTouchesX, _lastMoveX, moveX);
_recentTouchesY =
_removeTouchesInWrongDirection(_recentTouchesY, _lastMoveY, moveY);
- _recentTouchesX = _removeOldTouches(_recentTouchesX, e.timeStamp);
- _recentTouchesY = _removeOldTouches(_recentTouchesY, e.timeStamp);
+ _recentTouchesX = _removeOldTouches(_recentTouchesX, timeStamp);
+ _recentTouchesY = _removeOldTouches(_recentTouchesY, timeStamp);
_recentTouchesX.add(clientX);
- _recentTouchesX.add(e.timeStamp);
+ _recentTouchesX.add(timeStamp);
_recentTouchesY.add(clientY);
- _recentTouchesY.add(e.timeStamp);
+ _recentTouchesY.add(timeStamp);
}
_lastMoveX = moveX;
_lastMoveY = moveY;
@@ -322,14 +323,15 @@ class TouchHandler {
final touch = e.touches[0];
_startTouchX = _lastTouchX = touch.client.x;
_startTouchY = _lastTouchY = touch.client.y;
- _startTime = e.timeStamp;
+ int timeStamp = e.timeStamp.toInt();
+ _startTime = timeStamp;
// TODO(jacobr): why don't we just clear the lists?
_recentTouchesX = new List<int>();
_recentTouchesY = new List<int>();
_recentTouchesX.add(touch.client.x);
- _recentTouchesX.add(e.timeStamp);
+ _recentTouchesX.add(timeStamp);
_recentTouchesY.add(touch.client.y);
- _recentTouchesY.add(e.timeStamp);
+ _recentTouchesY.add(timeStamp);
_lastEvent = e;
_beginTracking();
}
« no previous file with comments | « no previous file | samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698