Bug 810364 - Use startX as current X in touch adapter. r=davidb
authorEitan Isaacson <eitan@monotonous.org>
Mon, 12 Nov 2012 15:46:09 -0800
changeset 113032 908a6c66f03dcb807889e19de3818368cd357ad5
parent 113031 7c4212c1e583c7b154a6bcc4a4fa2ee1c9dc35ad
child 113033 543413e0df7007b2b516f401cbfaef7d9589c7df
push id23848
push useremorley@mozilla.com
push dateTue, 13 Nov 2012 16:29:34 +0000
treeherdermozilla-central@d56d537a1843 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs810364
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 810364 - Use startX as current X in touch adapter. r=davidb
accessible/src/jsat/TouchAdapter.jsm
--- a/accessible/src/jsat/TouchAdapter.jsm
+++ b/accessible/src/jsat/TouchAdapter.jsm
@@ -202,34 +202,33 @@ this.TouchAdapter = {
 };
 
 /***
  * A TouchPoint represents a single touch from the moment of contact until it is
  * lifted from the surface. It is capable of compiling gestures from the scope
  * of one single touch.
  */
 function TouchPoint(aTouch, aTime, aDPI) {
-  this.startX = aTouch.screenX;
-  this.startY = aTouch.screenY;
+  this.startX = this.x = aTouch.screenX;
+  this.startY = this.y = aTouch.screenY;
   this.startTime = aTime;
   this.distanceTraveled = 0;
   this.dpi = aDPI;
   this.done = false;
 }
 
 TouchPoint.prototype = {
   update: function TouchPoint_update(aTouch, aTime) {
     let lastX = this.x;
     let lastY = this.y;
     this.x = aTouch.screenX;
     this.y = aTouch.screenY;
     this.time = aTime;
 
-    if (lastX != undefined && lastY != undefined)
-      this.distanceTraveled += this.getDistanceToCoord(lastX, lastY);
+    this.distanceTraveled += this.getDistanceToCoord(lastX, lastY);
   },
 
   getDistanceToCoord: function TouchPoint_getDistanceToCoord(aX, aY) {
     return Math.sqrt(Math.pow(this.x - aX, 2) + Math.pow(this.y - aY, 2));
   },
 
   finish: function TouchPoint_finish() {
     this.done = true;