Bug 961612 - [AccessFu] Don't scale mouse events specially on Android, r=MarcoZ

This commit is contained in:
Max Li 2014-01-19 23:22:51 -08:00
parent 6efadab648
commit 2a30d76183

View File

@ -334,8 +334,8 @@ this.TouchAdapter = {
* of one single touch.
*/
function TouchPoint(aTouch, aTime, aDPI) {
this.startX = this.x = aTouch.screenX * this.scaleFactor;
this.startY = this.y = aTouch.screenY * this.scaleFactor;
this.startX = this.x = aTouch.screenX;
this.startY = this.y = aTouch.screenY;
this.startTime = aTime;
this.distanceTraveled = 0;
this.dpi = aDPI;
@ -346,8 +346,8 @@ TouchPoint.prototype = {
update: function TouchPoint_update(aTouch, aTime) {
let lastX = this.x;
let lastY = this.y;
this.x = aTouch.screenX * this.scaleFactor;
this.y = aTouch.screenY * this.scaleFactor;
this.x = aTouch.screenX;
this.y = aTouch.screenY;
this.time = aTime;
this.distanceTraveled += this.getDistanceToCoord(lastX, lastY);
@ -357,20 +357,6 @@ TouchPoint.prototype = {
return Math.sqrt(Math.pow(this.x - aX, 2) + Math.pow(this.y - aY, 2));
},
get scaleFactor() {
if (!this._scaleFactor) {
// Android events come with the x, y coordinates affected by the widget
// scaling; we restore it to normal here.
if (Utils.MozBuildApp == 'mobile/android') {
this._scaleFactor = Utils.win.devicePixelRatio;
} else {
this._scaleFactor = 1;
}
}
return this._scaleFactor;
},
finish: function TouchPoint_finish() {
this.done = true;
},