mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1087608 - ensuring multitap gestures do not resolve to explore. r=eeejay, a=ritu
MozReview-Commit-ID: 9CZm709gGMC
This commit is contained in:
parent
96f93dc074
commit
e78cd0bb96
@ -13,10 +13,8 @@
|
||||
|
||||
DoubleTap -> TripleTap (x)
|
||||
-> TapHold (x)
|
||||
-> Explore (x)
|
||||
|
||||
TripleTap -> DoubleTapHold (x)
|
||||
-> Explore (x)
|
||||
|
||||
Dwell -> DwellEnd (v)
|
||||
|
||||
@ -39,7 +37,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ['GestureSettings', 'GestureTracker']; // jshint ignore:line
|
||||
@ -73,8 +70,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;
|
||||
// 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
|
||||
const EDGE = 0.1;
|
||||
// Multiply timeouts by this constant, x2 works great too for slower users.
|
||||
@ -211,7 +206,6 @@ this.GestureTracker = { // jshint ignore:line
|
||||
if (aDetail.type !== 'pointerdown') {
|
||||
return;
|
||||
}
|
||||
let points = aDetail.points;
|
||||
let GestureConstructor = aGesture || (IS_ANDROID ? DoubleTap : Tap);
|
||||
this._create(GestureConstructor);
|
||||
this._update(aDetail, aTimeStamp);
|
||||
@ -270,6 +264,7 @@ this.GestureTracker = { // jshint ignore:line
|
||||
this._create(gestureType, current.startTime, current.points,
|
||||
current.lastEvent);
|
||||
} else {
|
||||
this.current.clearTimer();
|
||||
delete this.current;
|
||||
}
|
||||
}
|
||||
@ -608,6 +603,9 @@ TravelGesture.prototype = Object.create(Gesture.prototype);
|
||||
* this._travelTo gesture iff at least one point crosses this._threshold.
|
||||
*/
|
||||
TravelGesture.prototype.test = function TravelGesture_test() {
|
||||
if (!this._travelTo) {
|
||||
return;
|
||||
}
|
||||
for (let identifier in this.points) {
|
||||
let point = this.points[identifier];
|
||||
if (point.totalDistanceTraveled / Utils.dpi > this._threshold) {
|
||||
@ -680,10 +678,10 @@ DoubleTapHoldEnd.prototype.type = 'doubletapholdend';
|
||||
* @param {Function} aRejectToOnWait A constructor for the next gesture to
|
||||
* reject to in case no pointermove or pointerup happens within the
|
||||
* GestureSettings.dwellThreshold.
|
||||
* @param {Function} aRejectToOnPointerDown A constructor for the gesture to
|
||||
* reject to if a finger comes down immediately after the tap.
|
||||
* @param {Function} aTravelTo An optional constuctor for the next gesture to
|
||||
* reject to in case the the TravelGesture test fails.
|
||||
* @param {Function} aRejectToOnPointerDown A constructor for the gesture to
|
||||
* reject to if a finger comes down immediately after the tap.
|
||||
*/
|
||||
function TapGesture(aTimeStamp, aPoints, aLastEvent, aRejectToOnWait, aTravelTo, aRejectToOnPointerDown) {
|
||||
this._rejectToOnWait = aRejectToOnWait;
|
||||
@ -722,11 +720,12 @@ TapGesture.prototype.pointerup = function TapGesture_pointerup(aPoints) {
|
||||
};
|
||||
|
||||
TapGesture.prototype.pointerdown = function TapGesture_pointerdown(aPoints, aTimeStamp) {
|
||||
TravelGesture.prototype.pointerdown.call(this, aPoints, aTimeStamp);
|
||||
if (this._pointerUpTimer) {
|
||||
clearTimeout(this._pointerUpTimer);
|
||||
delete this._pointerUpTimer;
|
||||
this._deferred.reject(this._rejectToOnPointerDown);
|
||||
} else {
|
||||
TravelGesture.prototype.pointerdown.call(this, aPoints, aTimeStamp);
|
||||
}
|
||||
};
|
||||
|
||||
@ -771,7 +770,7 @@ DoubleTap.prototype.type = 'doubletap';
|
||||
*/
|
||||
function TripleTap(aTimeStamp, aPoints, aLastEvent) {
|
||||
this._inProgress = true;
|
||||
TapGesture.call(this, aTimeStamp, aPoints, aLastEvent, DoubleTapHold);
|
||||
TapGesture.call(this, aTimeStamp, aPoints, aLastEvent, DoubleTapHold, null, null);
|
||||
}
|
||||
|
||||
TripleTap.prototype = Object.create(TapGesture.prototype);
|
||||
|
Loading…
Reference in New Issue
Block a user