Bug 1238368 - Re-introduce workaround for Android tap gesture. r=yzen

MozReview-Commit-ID: 6yfX4PDbnF3
This commit is contained in:
Eitan Isaacson 2016-02-12 10:43:38 -08:00
parent 771aa1c92b
commit 8b976a0055

View File

@ -79,6 +79,10 @@ const MOUSE_ID = 'mouse';
const EDGE = 0.1;
// Multiply timeouts by this constant, x2 works great too for slower users.
const TIMEOUT_MULTIPLIER = 1;
// A single pointer down/up sequence periodically precedes the tripple swipe
// gesture on Android. This delay acounts for that.
const IS_ANDROID = Utils.MozBuildApp === 'mobile/android' &&
Utils.AndroidSdkVersion >= 14;
/**
* A point object containing distance travelled data.
@ -202,13 +206,13 @@ this.GestureTracker = { // jshint ignore:line
* @param {Number} aTimeStamp A new pointer event timeStamp.
* @param {Function} aGesture A gesture constructor (default: Tap).
*/
_init: function GestureTracker__init(aDetail, aTimeStamp, aGesture = Tap) {
_init: function GestureTracker__init(aDetail, aTimeStamp, aGesture) {
// Only create a new gesture on |pointerdown| event.
if (aDetail.type !== 'pointerdown') {
return;
}
let points = aDetail.points;
let GestureConstructor = aGesture;
let GestureConstructor = aGesture || (IS_ANDROID ? DoubleTap : Tap);
this._create(GestureConstructor);
this._update(aDetail, aTimeStamp);
},