зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1019432 - [AccessFu] Only capture explore by touch events in Android. r=yzen
This commit is contained in:
Родитель
694eea169f
Коммит
29a74fb99d
|
@ -11,10 +11,6 @@
|
|||
-> Dwell (x)
|
||||
-> Swipe (x)
|
||||
|
||||
AndroidTap -> TripleTap (x)
|
||||
-> TapHold (x)
|
||||
-> Swipe (x)
|
||||
|
||||
DoubleTap -> TripleTap (x)
|
||||
-> TapHold (x)
|
||||
-> Explore (x)
|
||||
|
@ -77,12 +73,6 @@ const TAP_MAX_RADIUS = 0.2;
|
|||
// Directness coefficient. It is based on the maximum 15 degree angle between
|
||||
// consequent pointer move lines.
|
||||
const DIRECTNESS_COEFF = 1.44;
|
||||
// An android flag.
|
||||
const IS_ANDROID = Utils.MozBuildApp === 'mobile/android' &&
|
||||
Utils.AndroidSdkVersion >= 14;
|
||||
// A single pointer down/up sequence periodically precedes the tripple swipe
|
||||
// gesture on Android. This delay acounts for that.
|
||||
const ANDROID_TRIPLE_SWIPE_DELAY = 50;
|
||||
// The virtual touch ID generated by a mouse event.
|
||||
const MOUSE_ID = 'mouse';
|
||||
// Amount in inches from the edges of the screen for it to be an edge swipe
|
||||
|
@ -211,12 +201,6 @@ this.GestureTracker = { // jshint ignore:line
|
|||
}
|
||||
let points = aDetail.points;
|
||||
let GestureConstructor = aGesture;
|
||||
if (IS_ANDROID && GestureConstructor === Tap && points.length === 1 &&
|
||||
points[0].identifier !== MOUSE_ID) {
|
||||
// Handle Android events when EBT is enabled. Two finger gestures are
|
||||
// translated to one.
|
||||
GestureConstructor = AndroidTap;
|
||||
}
|
||||
this._create(GestureConstructor);
|
||||
this._update(aDetail, aTimeStamp);
|
||||
},
|
||||
|
@ -743,54 +727,6 @@ function Tap(aTimeStamp, aPoints, aLastEvent) {
|
|||
Tap.prototype = Object.create(TapGesture.prototype);
|
||||
Tap.prototype.type = 'tap';
|
||||
|
||||
/**
|
||||
* Tap (multi) gesture on Android.
|
||||
* @param {Number} aTimeStamp An original pointer event's timeStamp that started
|
||||
* the gesture resolution sequence.
|
||||
* @param {Object} aPoints An existing set of points (from previous events).
|
||||
* @param {?String} aLastEvent Last pointer event type.
|
||||
*/
|
||||
function AndroidTap(aTimeStamp, aPoints, aLastEvent) {
|
||||
// If the pointer travels, reject to Swipe. On dwell threshold reject to
|
||||
// TapHold.
|
||||
TapGesture.call(this, aTimeStamp, aPoints, aLastEvent, TapHold, Swipe, TripleTap);
|
||||
}
|
||||
AndroidTap.prototype = Object.create(TapGesture.prototype);
|
||||
// Android double taps are translated to single taps.
|
||||
AndroidTap.prototype.type = 'doubletap';
|
||||
|
||||
/**
|
||||
* Clear the pointerup handler timer in case of the 3 pointer swipe.
|
||||
*/
|
||||
AndroidTap.prototype.clearThreeFingerSwipeTimer = function AndroidTap_clearThreeFingerSwipeTimer() {
|
||||
clearTimeout(this._threeFingerSwipeTimer);
|
||||
delete this._threeFingerSwipeTimer;
|
||||
};
|
||||
|
||||
AndroidTap.prototype.pointerdown = function AndroidTap_pointerdown(aPoints, aTimeStamp) {
|
||||
this.clearThreeFingerSwipeTimer();
|
||||
TapGesture.prototype.pointerdown.call(this, aPoints, aTimeStamp);
|
||||
};
|
||||
|
||||
AndroidTap.prototype.pointermove = function AndroidTap_pointermove(aPoints) {
|
||||
this.clearThreeFingerSwipeTimer();
|
||||
this._moved = true;
|
||||
TapGesture.prototype.pointermove.call(this, aPoints);
|
||||
};
|
||||
|
||||
AndroidTap.prototype.pointerup = function AndroidTap_pointerup(aPoints) {
|
||||
if (this._moved) {
|
||||
// If there was a pointer move - handle the real gesture.
|
||||
TapGesture.prototype.pointerup.call(this, aPoints);
|
||||
} else {
|
||||
// Primptively delay the multi pointer gesture resolution, because Android
|
||||
// sometimes fires a pointerdown/poitnerup sequence before the real events.
|
||||
this._threeFingerSwipeTimer = setTimeout(() => {
|
||||
delete this._threeFingerSwipeTimer;
|
||||
TapGesture.prototype.pointerup.call(this, aPoints);
|
||||
}, ANDROID_TRIPLE_SWIPE_DELAY);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Double Tap gesture.
|
||||
|
|
|
@ -39,8 +39,14 @@ let PointerRelay = { // jshint ignore:line
|
|||
delete this._eventsOfInterest;
|
||||
|
||||
switch (Utils.widgetToolkit) {
|
||||
case 'gonk':
|
||||
case 'android':
|
||||
this._eventsOfInterest = {
|
||||
'touchstart' : true,
|
||||
'touchmove' : true,
|
||||
'touchend' : true };
|
||||
break;
|
||||
|
||||
case 'gonk':
|
||||
this._eventsOfInterest = {
|
||||
'touchstart' : true,
|
||||
'touchmove' : true,
|
||||
|
@ -117,12 +123,7 @@ let PointerRelay = { // jshint ignore:line
|
|||
|
||||
if (Utils.widgetToolkit === 'android' &&
|
||||
changedTouches.length === 1 && changedTouches[0].identifier === 1) {
|
||||
changedTouches = [{
|
||||
identifier: 0,
|
||||
screenX: changedTouches[0].screenX + 5,
|
||||
screenY: changedTouches[0].screenY + 5,
|
||||
target: changedTouches[0].target
|
||||
}, changedTouches[0]];
|
||||
return;
|
||||
}
|
||||
|
||||
if (changedTouches.length === 1 &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче